diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperations.cs
new file mode 100644
index 000000000000..ac8bca7e529f
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperations.cs
@@ -0,0 +1,1206 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ 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;
+
+ ///
+ /// ActionGroupsOperations operations.
+ ///
+ internal partial class ActionGroupsOperations : IServiceOperations, IActionGroupsOperations
+ {
+ ///
+ /// Initializes a new instance of the ActionGroupsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal ActionGroupsOperations(MonitorManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the MonitorManagementClient
+ ///
+ public MonitorManagementClient Client { get; private set; }
+
+ ///
+ /// Create a new action group or update an existing one.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The action group to create or use for the update.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (actionGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName");
+ }
+ if (actionGroup == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "actionGroup");
+ }
+ if (actionGroup != null)
+ {
+ actionGroup.Validate();
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("actionGroupName", actionGroupName);
+ tracingParameters.Add("actionGroup", actionGroup);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(actionGroup != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(actionGroup, 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;
+ }
+
+ ///
+ /// Get an action group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (actionGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("actionGroupName", actionGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 404)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete an action group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (actionGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("actionGroupName", actionGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get a list of all action groups in a subscription.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionId", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get a list of all action groups in a resource group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Enable a receiver in an action group. This changes the receiver's status
+ /// from Disabled to Enabled.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The name of the receiver to resubscribe.
+ ///
+ ///
+ /// 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 EnableReceiverWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, string receiverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (actionGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (receiverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "receiverName");
+ }
+ string apiVersion = "2017-04-01";
+ EnableRequest enableRequest = new EnableRequest();
+ if (receiverName != null)
+ {
+ enableRequest.ReceiverName = receiverName;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("actionGroupName", actionGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("enableRequest", enableRequest);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "EnableReceiver", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName));
+ _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;
+ if(enableRequest != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(enableRequest, 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 != 409 && (int)_statusCode != 404)
+ {
+ 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/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperationsExtensions.cs
new file mode 100644
index 000000000000..adf808ff3f59
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActionGroupsOperationsExtensions.cs
@@ -0,0 +1,258 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ 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 ActionGroupsOperations.
+ ///
+ public static partial class ActionGroupsOperationsExtensions
+ {
+ ///
+ /// Create a new action group or update an existing one.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The action group to create or use for the update.
+ ///
+ public static ActionGroupResource CreateOrUpdate(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, actionGroupName, actionGroup).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create a new action group or update an existing one.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The action group to create or use for the update.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, actionGroupName, actionGroup, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get an action group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ public static ActionGroupResource Get(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName)
+ {
+ return operations.GetAsync(resourceGroupName, actionGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get an action group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, actionGroupName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete an action group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ public static void Delete(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName)
+ {
+ operations.DeleteAsync(resourceGroupName, actionGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete an action group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, actionGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Get a list of all action groups in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IEnumerable ListBySubscriptionId(this IActionGroupsOperations operations)
+ {
+ return operations.ListBySubscriptionIdAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of all action groups in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListBySubscriptionIdAsync(this IActionGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListBySubscriptionIdWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get a list of all action groups in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ public static IEnumerable ListByResourceGroup(this IActionGroupsOperations operations, string resourceGroupName)
+ {
+ return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of all action groups in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByResourceGroupAsync(this IActionGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Enable a receiver in an action group. This changes the receiver's status
+ /// from Disabled to Enabled.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The name of the receiver to resubscribe.
+ ///
+ public static void EnableReceiver(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, string receiverName)
+ {
+ operations.EnableReceiverAsync(resourceGroupName, actionGroupName, receiverName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Enable a receiver in an action group. This changes the receiver's status
+ /// from Disabled to Enabled.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The name of the receiver to resubscribe.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task EnableReceiverAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, string receiverName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.EnableReceiverWithHttpMessagesAsync(resourceGroupName, actionGroupName, receiverName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperations.cs
new file mode 100644
index 000000000000..4fb4ef511026
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperations.cs
@@ -0,0 +1,1192 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ 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;
+
+ ///
+ /// ActivityLogAlertsOperations operations.
+ ///
+ internal partial class ActivityLogAlertsOperations : IServiceOperations, IActivityLogAlertsOperations
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal ActivityLogAlertsOperations(MonitorManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the MonitorManagementClient
+ ///
+ public MonitorManagementClient Client { get; private set; }
+
+ ///
+ /// Create a new activity log alert or update an existing one.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The activity log alert to create or use for the update.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName");
+ }
+ if (activityLogAlert == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlert");
+ }
+ if (activityLogAlert != null)
+ {
+ activityLogAlert.Validate();
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("activityLogAlertName", activityLogAlertName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("activityLogAlert", activityLogAlert);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName));
+ 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(activityLogAlert != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlert, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get an activity log alert.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("activityLogAlertName", activityLogAlertName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName));
+ 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete an activity log alert.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("activityLogAlertName", activityLogAlertName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName));
+ 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields
+ /// use the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (activityLogAlertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName");
+ }
+ if (activityLogAlertPatch == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertPatch");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("activityLogAlertName", activityLogAlertName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("activityLogAlertPatch", activityLogAlertPatch);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(activityLogAlertPatch != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlertPatch, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a subscription.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionId", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a resource group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ string apiVersion = "2017-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperationsExtensions.cs
new file mode 100644
index 000000000000..38f4eecf4095
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ActivityLogAlertsOperationsExtensions.cs
@@ -0,0 +1,261 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ 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 ActivityLogAlertsOperations.
+ ///
+ public static partial class ActivityLogAlertsOperationsExtensions
+ {
+ ///
+ /// Create a new activity log alert or update an existing one.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The activity log alert to create or use for the update.
+ ///
+ public static ActivityLogAlertResource CreateOrUpdate(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlert).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create a new activity log alert or update an existing one.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The activity log alert to create or use for the update.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlert, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get an activity log alert.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName)
+ {
+ return operations.GetAsync(resourceGroupName, activityLogAlertName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get an activity log alert.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete an activity log alert.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ public static void Delete(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName)
+ {
+ operations.DeleteAsync(resourceGroupName, activityLogAlertName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete an activity log alert.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields
+ /// use the CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static ActivityLogAlertResource Update(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch)
+ {
+ return operations.UpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Updates an existing ActivityLogAlertResource's tags. To update other fields
+ /// use the CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IEnumerable ListBySubscriptionId(this IActivityLogAlertsOperations operations)
+ {
+ return operations.ListBySubscriptionIdAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListBySubscriptionIdAsync(this IActivityLogAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListBySubscriptionIdWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ public static IEnumerable ListByResourceGroup(this IActivityLogAlertsOperations operations, string resourceGroupName)
+ {
+ return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of all activity log alerts in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByResourceGroupAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperations.cs
index 7d90f47c45ce..9a657939d0e1 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperationsExtensions.cs
index aaf037791c10..fecc3699846d 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperationsExtensions.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRuleIncidentsOperationsExtensions.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperations.cs
index 31f59eb4b894..d68170b3a470 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -643,6 +643,228 @@ internal AlertRulesOperations(MonitorManagementClient client)
return _result;
}
+ ///
+ /// Updates an existing AlertRuleResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the rule.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (ruleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ruleName");
+ }
+ if (alertRulesResource == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertRulesResource");
+ }
+ string apiVersion = "2016-03-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("ruleName", ruleName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertRulesResource", alertRulesResource);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(alertRulesResource != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertRulesResource, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// List the alert rules within a resource group.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperationsExtensions.cs
index 7b525f3239e7..f72e2eba7ce6 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperationsExtensions.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AlertRulesOperationsExtensions.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -147,6 +147,54 @@ public static AlertRuleResource Get(this IAlertRulesOperations operations, strin
}
}
+ ///
+ /// Updates an existing AlertRuleResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the rule.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static AlertRuleResource Update(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource)
+ {
+ return operations.UpdateAsync(resourceGroupName, ruleName, alertRulesResource).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Updates an existing AlertRuleResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the rule.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, alertRulesResource, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
///
/// List the alert rules within a resource group.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperations.cs
index 45b50e6f4b42..8b51f3e1765d 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -813,6 +813,210 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client)
return _result;
}
+ ///
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use
+ /// the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The autoscale setting name.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (autoscaleSettingName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName");
+ }
+ if (autoscaleSettingResource == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingResource");
+ }
+ string apiVersion = "2015-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("autoscaleSettingName", autoscaleSettingName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("autoscaleSettingResource", autoscaleSettingResource);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(autoscaleSettingResource != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(autoscaleSettingResource, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// Lists the autoscale settings for a resource group
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperationsExtensions.cs
index cc9b8385113e..fe70a79aafbe 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperationsExtensions.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/AutoscaleSettingsOperationsExtensions.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -179,6 +179,54 @@ public static AutoscaleSettingResource Get(this IAutoscaleSettingsOperations ope
}
}
+ ///
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use
+ /// the CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The autoscale setting name.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static AutoscaleSettingResource Update(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource)
+ {
+ return operations.UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Updates an existing AutoscaleSettingsResource. To update other fields use
+ /// the CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The autoscale setting name.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
///
/// Lists the autoscale settings for a resource group
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActionGroupsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActionGroupsOperations.cs
new file mode 100644
index 000000000000..7955c38f906d
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActionGroupsOperations.cs
@@ -0,0 +1,170 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ActionGroupsOperations operations.
+ ///
+ public partial interface IActionGroupsOperations
+ {
+ ///
+ /// Create a new action group or update an existing one.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The action group to create or use for the update.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get an action group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Delete an action group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get a list of all action groups in a subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get a list of all action groups in a resource group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Enable a receiver in an action group. This changes the receiver's
+ /// status from Disabled to Enabled.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the action group.
+ ///
+ ///
+ /// The name of the receiver to resubscribe.
+ ///
+ ///
+ /// 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 EnableReceiverWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, string receiverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActivityLogAlertsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActivityLogAlertsOperations.cs
new file mode 100644
index 000000000000..c1f7b6075ea0
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IActivityLogAlertsOperations.cs
@@ -0,0 +1,173 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ActivityLogAlertsOperations operations.
+ ///
+ public partial interface IActivityLogAlertsOperations
+ {
+ ///
+ /// Create a new activity log alert or update an existing one.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The activity log alert to create or use for the update.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get an activity log alert.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Delete an activity log alert.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Updates an existing ActivityLogAlertResource's tags. To update
+ /// other fields use the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the activity log alert.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get a list of all activity log alerts in a subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get a list of all activity log alerts in a resource group.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRuleIncidentsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRuleIncidentsOperations.cs
index c7310d2999cb..405f39fc74f5 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRuleIncidentsOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRuleIncidentsOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRulesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRulesOperations.cs
index 865e9941a078..b3612ad8e017 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRulesOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAlertRulesOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -100,6 +100,35 @@ public partial interface IAlertRulesOperations
///
Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
+ /// Updates an existing AlertRuleResource. To update other fields use
+ /// the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The name of the rule.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
/// List the alert rules within a resource group.
///
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAutoscaleSettingsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAutoscaleSettingsOperations.cs
index 4ae998016a58..1e005021284a 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAutoscaleSettingsOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IAutoscaleSettingsOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -122,6 +122,35 @@ public partial interface IAutoscaleSettingsOperations
///
Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
+ /// Updates an existing AutoscaleSettingsResource. To update other
+ /// fields use the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// The autoscale setting name.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
/// Lists the autoscale settings for a resource group
///
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ILogProfilesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ILogProfilesOperations.cs
index cc7def846eae..d38ab961c815 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ILogProfilesOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/ILogProfilesOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -91,6 +91,32 @@ public partial interface ILogProfilesOperations
///
Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
+ /// Updates an existing LogProfilesResource. To update other fields use
+ /// the CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the log profile.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
/// List the log profiles.
///
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IMonitorManagementClient.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IMonitorManagementClient.cs
index 0f8555364170..d62aaa694188 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IMonitorManagementClient.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IMonitorManagementClient.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.Monitor.Management
using Newtonsoft.Json;
///
- /// Composite Swagger for Monitor Management Client
+ /// Monitor Management Client
///
public partial interface IMonitorManagementClient : System.IDisposable
{
@@ -70,14 +70,14 @@ public partial interface IMonitorManagementClient : System.IDisposable
IAutoscaleSettingsOperations AutoscaleSettings { get; }
///
- /// Gets the IAlertRulesOperations.
+ /// Gets the IAlertRuleIncidentsOperations.
///
- IAlertRulesOperations AlertRules { get; }
+ IAlertRuleIncidentsOperations AlertRuleIncidents { get; }
///
- /// Gets the IAlertRuleIncidentsOperations.
+ /// Gets the IAlertRulesOperations.
///
- IAlertRuleIncidentsOperations AlertRuleIncidents { get; }
+ IAlertRulesOperations AlertRules { get; }
///
/// Gets the ILogProfilesOperations.
@@ -89,5 +89,15 @@ public partial interface IMonitorManagementClient : System.IDisposable
///
IServiceDiagnosticSettingsOperations ServiceDiagnosticSettings { get; }
+ ///
+ /// Gets the IActionGroupsOperations.
+ ///
+ IActionGroupsOperations ActionGroups { get; }
+
+ ///
+ /// Gets the IActivityLogAlertsOperations.
+ ///
+ IActivityLogAlertsOperations ActivityLogAlerts { get; }
+
}
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IServiceDiagnosticSettingsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IServiceDiagnosticSettingsOperations.cs
index 448d06067ff1..06d771b34732 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IServiceDiagnosticSettingsOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/IServiceDiagnosticSettingsOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -100,6 +100,6 @@ public partial interface IServiceDiagnosticSettingsOperations
///
/// Thrown when a required parameter is null
///
- Task> UpdateWithHttpMessagesAsync(string resourceUri, ServiceDiagnosticSettingsResource serviceDiagnosticSettingsResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> UpdateWithHttpMessagesAsync(string resourceUri, ServiceDiagnosticSettingsResourcePatch serviceDiagnosticSettingsResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperations.cs
index 07af14beefdd..71d6c51de8e5 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperations.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperations.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -598,6 +598,201 @@ internal LogProfilesOperations(MonitorManagementClient client)
return _result;
}
+ ///
+ /// Updates an existing LogProfilesResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The name of the log profile.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (logProfileName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName");
+ }
+ if (logProfilesResource == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "logProfilesResource");
+ }
+ string apiVersion = "2016-03-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("logProfileName", logProfileName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("logProfilesResource", logProfilesResource);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(logProfilesResource != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(logProfilesResource, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// List the log profiles.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperationsExtensions.cs
index 6801faa0a15f..53cf2287f32d 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperationsExtensions.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/LogProfilesOperationsExtensions.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -129,6 +129,48 @@ public static LogProfileResource CreateOrUpdate(this ILogProfilesOperations oper
}
}
+ ///
+ /// Updates an existing LogProfilesResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the log profile.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static LogProfileResource Update(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource)
+ {
+ return operations.UpdateAsync(logProfileName, logProfilesResource).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Updates an existing LogProfilesResource. To update other fields use the
+ /// CreateOrUpdate method.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the log profile.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(logProfileName, logProfilesResource, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
///
/// List the log profiles.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActionGroupResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActionGroupResource.cs
new file mode 100644
index 000000000000..e67be2ac5bd5
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActionGroupResource.cs
@@ -0,0 +1,159 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// An action group resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class ActionGroupResource : Resource
+ {
+ ///
+ /// Initializes a new instance of the ActionGroupResource class.
+ ///
+ public ActionGroupResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActionGroupResource class.
+ ///
+ /// Resource location
+ /// The short name of the action group.
+ /// This will be used in SMS messages.
+ /// Indicates whether this action group is
+ /// enabled. If an action group is not enabled, then none of its
+ /// receviers will receive communications.
+ /// Azure resource Id
+ /// Azure resource name
+ /// Azure resource type
+ /// Resource tags
+ /// The list of email receivers that are
+ /// part of this action group.
+ /// The list of SMS receivers that are part
+ /// of this action group.
+ /// The list of webhook receivers that
+ /// are part of this action group.
+ public ActionGroupResource(string location, string groupShortName, bool enabled, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList emailReceivers = default(IList), IList smsReceivers = default(IList), IList webhookReceivers = default(IList))
+ : base(location, id, name, type, tags)
+ {
+ GroupShortName = groupShortName;
+ Enabled = enabled;
+ EmailReceivers = emailReceivers;
+ SmsReceivers = smsReceivers;
+ WebhookReceivers = webhookReceivers;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the short name of the action group. This will be used
+ /// in SMS messages.
+ ///
+ [JsonProperty(PropertyName = "properties.groupShortName")]
+ public string GroupShortName { get; set; }
+
+ ///
+ /// Gets or sets indicates whether this action group is enabled. If an
+ /// action group is not enabled, then none of its receviers will
+ /// receive communications.
+ ///
+ [JsonProperty(PropertyName = "properties.enabled")]
+ public bool Enabled { get; set; }
+
+ ///
+ /// Gets or sets the list of email receivers that are part of this
+ /// action group.
+ ///
+ [JsonProperty(PropertyName = "properties.emailReceivers")]
+ public IList EmailReceivers { get; set; }
+
+ ///
+ /// Gets or sets the list of SMS receivers that are part of this action
+ /// group.
+ ///
+ [JsonProperty(PropertyName = "properties.smsReceivers")]
+ public IList SmsReceivers { get; set; }
+
+ ///
+ /// Gets or sets the list of webhook receivers that are part of this
+ /// action group.
+ ///
+ [JsonProperty(PropertyName = "properties.webhookReceivers")]
+ public IList WebhookReceivers { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public override void Validate()
+ {
+ base.Validate();
+ if (GroupShortName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "GroupShortName");
+ }
+ if (GroupShortName != null)
+ {
+ if (GroupShortName.Length > 15)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "GroupShortName", 15);
+ }
+ }
+ if (EmailReceivers != null)
+ {
+ foreach (var element in EmailReceivers)
+ {
+ if (element != null)
+ {
+ element.Validate();
+ }
+ }
+ }
+ if (SmsReceivers != null)
+ {
+ foreach (var element1 in SmsReceivers)
+ {
+ if (element1 != null)
+ {
+ element1.Validate();
+ }
+ }
+ }
+ if (WebhookReceivers != null)
+ {
+ foreach (var element2 in WebhookReceivers)
+ {
+ if (element2 != null)
+ {
+ element2.Validate();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionGroup.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionGroup.cs
new file mode 100644
index 000000000000..6fcfb91bc2f5
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionGroup.cs
@@ -0,0 +1,84 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// A pointer to an Azure Action Group.
+ ///
+ public partial class ActivityLogAlertActionGroup
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertActionGroup
+ /// class.
+ ///
+ public ActivityLogAlertActionGroup()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertActionGroup
+ /// class.
+ ///
+ /// The resourceId of the action group.
+ /// This cannot be null or empty.
+ /// the dictionary of custom properties
+ /// to include with the post operation. These data are appended to the
+ /// webhook payload.
+ public ActivityLogAlertActionGroup(string actionGroupId, IDictionary webhookProperties = default(IDictionary))
+ {
+ ActionGroupId = actionGroupId;
+ WebhookProperties = webhookProperties;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resourceId of the action group. This cannot be
+ /// null or empty.
+ ///
+ [JsonProperty(PropertyName = "actionGroupId")]
+ public string ActionGroupId { get; set; }
+
+ ///
+ /// Gets or sets the dictionary of custom properties to include with
+ /// the post operation. These data are appended to the webhook payload.
+ ///
+ [JsonProperty(PropertyName = "webhookProperties")]
+ public IDictionary WebhookProperties { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (ActionGroupId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ActionGroupId");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionList.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionList.cs
new file mode 100644
index 000000000000..3a6929e7bcf8
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertActionList.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// A list of activity log alert actions.
+ ///
+ public partial class ActivityLogAlertActionList
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertActionList class.
+ ///
+ public ActivityLogAlertActionList()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertActionList class.
+ ///
+ /// The list of activity log alerts.
+ public ActivityLogAlertActionList(IList actionGroups = default(IList))
+ {
+ ActionGroups = actionGroups;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the list of activity log alerts.
+ ///
+ [JsonProperty(PropertyName = "actionGroups")]
+ public IList ActionGroups { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertAllOfCondition.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertAllOfCondition.cs
new file mode 100644
index 000000000000..4baf4af4c540
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertAllOfCondition.cs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// An Activity Log alert condition that is met when all its member
+ /// conditions are met.
+ ///
+ public partial class ActivityLogAlertAllOfCondition
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertAllOfCondition
+ /// class.
+ ///
+ public ActivityLogAlertAllOfCondition()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertAllOfCondition
+ /// class.
+ ///
+ /// The list of activity log alert
+ /// conditions.
+ public ActivityLogAlertAllOfCondition(IList allOf)
+ {
+ AllOf = allOf;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the list of activity log alert conditions.
+ ///
+ [JsonProperty(PropertyName = "allOf")]
+ public IList AllOf { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (AllOf == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "AllOf");
+ }
+ if (AllOf != null)
+ {
+ foreach (var element in AllOf)
+ {
+ if (element != null)
+ {
+ element.Validate();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertLeafCondition.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertLeafCondition.cs
new file mode 100644
index 000000000000..ec5af6a93398
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertLeafCondition.cs
@@ -0,0 +1,92 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An Activity Log alert condition that is met by comparing an activity
+ /// log field and value.
+ ///
+ public partial class ActivityLogAlertLeafCondition
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertLeafCondition
+ /// class.
+ ///
+ public ActivityLogAlertLeafCondition()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertLeafCondition
+ /// class.
+ ///
+ /// The name of the field that this condition will
+ /// examine. The possible values for this field are (case-insensitive):
+ /// 'resourceId', 'category', 'caller', 'level', 'operationName',
+ /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus',
+ /// 'resourceType', or anything beginning with 'properties.'.
+ /// The field value will be compared to this value
+ /// (case-insensitive) to determine if the condition is met.
+ public ActivityLogAlertLeafCondition(string field, string equals)
+ {
+ Field = field;
+ Equals = equals;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the field that this condition will
+ /// examine. The possible values for this field are (case-insensitive):
+ /// 'resourceId', 'category', 'caller', 'level', 'operationName',
+ /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus',
+ /// 'resourceType', or anything beginning with 'properties.'.
+ ///
+ [JsonProperty(PropertyName = "field")]
+ public string Field { get; set; }
+
+ ///
+ /// Gets or sets the field value will be compared to this value
+ /// (case-insensitive) to determine if the condition is met.
+ ///
+ [JsonProperty(PropertyName = "equals")]
+ public string Equals { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Field == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Field");
+ }
+ if (Equals == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Equals");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertPatchBody.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertPatchBody.cs
new file mode 100644
index 000000000000..b9acfc5140a2
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertPatchBody.cs
@@ -0,0 +1,70 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// An activity log alert object for the body of patch operations.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class ActivityLogAlertPatchBody
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertPatchBody class.
+ ///
+ public ActivityLogAlertPatchBody()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertPatchBody class.
+ ///
+ /// Resource tags
+ /// Indicates whether this activity log alert is
+ /// enabled. If an activity log alert is not enabled, then none of its
+ /// actions will be activated.
+ public ActivityLogAlertPatchBody(IDictionary tags = default(IDictionary), bool? enabled = default(bool?))
+ {
+ Tags = tags;
+ Enabled = enabled;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets indicates whether this activity log alert is enabled.
+ /// If an activity log alert is not enabled, then none of its actions
+ /// will be activated.
+ ///
+ [JsonProperty(PropertyName = "properties.enabled")]
+ public bool? Enabled { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertResource.cs
new file mode 100644
index 000000000000..de21e07e2048
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ActivityLogAlertResource.cs
@@ -0,0 +1,136 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// An activity log alert resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class ActivityLogAlertResource : Resource
+ {
+ ///
+ /// Initializes a new instance of the ActivityLogAlertResource class.
+ ///
+ public ActivityLogAlertResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ActivityLogAlertResource class.
+ ///
+ /// Resource location
+ /// A list of resourceIds that will be used as
+ /// prefixes. The alert will only apply to activityLogs with
+ /// resourceIds that fall under one of these prefixes. This list must
+ /// include at least one item.
+ /// The conditon that will cause this alert to
+ /// activate.
+ /// The actions that will activate when the
+ /// condition is met.
+ /// Azure resource Id
+ /// Azure resource name
+ /// Azure resource type
+ /// Resource tags
+ /// Indicates whether this activity log alert is
+ /// enabled. If an activity log alert is not enabled, then none of its
+ /// actions will be activated.
+ /// A description of this activity log
+ /// alert.
+ public ActivityLogAlertResource(string location, IList scopes, ActivityLogAlertAllOfCondition condition, ActivityLogAlertActionList actions, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), bool? enabled = default(bool?), string description = default(string))
+ : base(location, id, name, type, tags)
+ {
+ Scopes = scopes;
+ Enabled = enabled;
+ Condition = condition;
+ Actions = actions;
+ Description = description;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets a list of resourceIds that will be used as prefixes.
+ /// The alert will only apply to activityLogs with resourceIds that
+ /// fall under one of these prefixes. This list must include at least
+ /// one item.
+ ///
+ [JsonProperty(PropertyName = "properties.scopes")]
+ public IList Scopes { get; set; }
+
+ ///
+ /// Gets or sets indicates whether this activity log alert is enabled.
+ /// If an activity log alert is not enabled, then none of its actions
+ /// will be activated.
+ ///
+ [JsonProperty(PropertyName = "properties.enabled")]
+ public bool? Enabled { get; set; }
+
+ ///
+ /// Gets or sets the conditon that will cause this alert to activate.
+ ///
+ [JsonProperty(PropertyName = "properties.condition")]
+ public ActivityLogAlertAllOfCondition Condition { get; set; }
+
+ ///
+ /// Gets or sets the actions that will activate when the condition is
+ /// met.
+ ///
+ [JsonProperty(PropertyName = "properties.actions")]
+ public ActivityLogAlertActionList Actions { get; set; }
+
+ ///
+ /// Gets or sets a description of this activity log alert.
+ ///
+ [JsonProperty(PropertyName = "properties.description")]
+ public string Description { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public override void Validate()
+ {
+ base.Validate();
+ if (Scopes == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Scopes");
+ }
+ if (Condition == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Condition");
+ }
+ if (Actions == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Actions");
+ }
+ if (Condition != null)
+ {
+ Condition.Validate();
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResource.cs
index 5237bb632457..126a838160a0 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResource.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResource.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -28,7 +28,10 @@ public partial class AlertRuleResource : Resource
///
/// Initializes a new instance of the AlertRuleResource class.
///
- public AlertRuleResource() { }
+ public AlertRuleResource()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the AlertRuleResource class.
@@ -60,8 +63,14 @@ public AlertRuleResource() { }
Condition = condition;
Actions = actions;
LastUpdatedTime = lastUpdatedTime;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the name of the alert rule.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResourcePatch.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResourcePatch.cs
new file mode 100644
index 000000000000..7d7cca1e07ca
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AlertRuleResourcePatch.cs
@@ -0,0 +1,133 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The alert rule object for patch operations.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class AlertRuleResourcePatch
+ {
+ ///
+ /// Initializes a new instance of the AlertRuleResourcePatch class.
+ ///
+ public AlertRuleResourcePatch()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the AlertRuleResourcePatch class.
+ ///
+ /// the name of the alert rule.
+ /// the flag that indicates whether the alert
+ /// rule is enabled.
+ /// the condition that results in the alert
+ /// rule being activated.
+ /// Resource tags
+ /// the description of the alert rule that
+ /// will be included in the alert email.
+ /// the array of actions that are performed when
+ /// the alert rule becomes active, and when an alert condition is
+ /// resolved.
+ /// Last time the rule was updated in
+ /// ISO8601 format.
+ public AlertRuleResourcePatch(string name, bool isEnabled, RuleCondition condition, IDictionary tags = default(IDictionary), string description = default(string), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?))
+ {
+ Tags = tags;
+ Name = name;
+ Description = description;
+ IsEnabled = isEnabled;
+ Condition = condition;
+ Actions = actions;
+ LastUpdatedTime = lastUpdatedTime;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the name of the alert rule.
+ ///
+ [JsonProperty(PropertyName = "properties.name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the description of the alert rule that will be
+ /// included in the alert email.
+ ///
+ [JsonProperty(PropertyName = "properties.description")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the flag that indicates whether the alert rule is
+ /// enabled.
+ ///
+ [JsonProperty(PropertyName = "properties.isEnabled")]
+ public bool IsEnabled { get; set; }
+
+ ///
+ /// Gets or sets the condition that results in the alert rule being
+ /// activated.
+ ///
+ [JsonProperty(PropertyName = "properties.condition")]
+ public RuleCondition Condition { get; set; }
+
+ ///
+ /// Gets or sets the array of actions that are performed when the alert
+ /// rule becomes active, and when an alert condition is resolved.
+ ///
+ [JsonProperty(PropertyName = "properties.actions")]
+ public IList Actions { get; set; }
+
+ ///
+ /// Gets last time the rule was updated in ISO8601 format.
+ ///
+ [JsonProperty(PropertyName = "properties.lastUpdatedTime")]
+ public System.DateTime? LastUpdatedTime { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ if (Condition == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Condition");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleNotification.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleNotification.cs
index e9a9cb96aa10..e924e0bbd6a6 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleNotification.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleNotification.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -25,7 +25,10 @@ public partial class AutoscaleNotification
///
/// Initializes a new instance of the AutoscaleNotification class.
///
- public AutoscaleNotification() { }
+ public AutoscaleNotification()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the AutoscaleNotification class.
@@ -37,6 +40,7 @@ public AutoscaleNotification() { }
{
Email = email;
Webhooks = webhooks;
+ CustomInit();
}
///
/// Static constructor for AutoscaleNotification class.
@@ -46,6 +50,11 @@ static AutoscaleNotification()
Operation = "Scale";
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the email notification.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleProfile.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleProfile.cs
index 36a75a9bd535..0f7b62895217 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleProfile.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleProfile.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -26,7 +26,10 @@ public partial class AutoscaleProfile
///
/// Initializes a new instance of the AutoscaleProfile class.
///
- public AutoscaleProfile() { }
+ public AutoscaleProfile()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the AutoscaleProfile class.
@@ -49,8 +52,14 @@ public AutoscaleProfile() { }
Rules = rules;
FixedDate = fixedDate;
Recurrence = recurrence;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the name of the profile.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResource.cs
index 629b7f278181..c5a53f0ea6f4 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResource.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResource.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -28,7 +28,10 @@ public partial class AutoscaleSettingResource : Resource
///
/// Initializes a new instance of the AutoscaleSettingResource class.
///
- public AutoscaleSettingResource() { }
+ public AutoscaleSettingResource()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the AutoscaleSettingResource class.
@@ -58,8 +61,14 @@ public AutoscaleSettingResource() { }
Enabled = enabled;
AutoscaleSettingResourceName = autoscaleSettingResourceName;
TargetResourceUri = targetResourceUri;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the collection of automatic scaling profiles that
/// specify different scaling parameters for different time periods. A
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResourcePatch.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResourcePatch.cs
new file mode 100644
index 000000000000..2dca10d46c53
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/AutoscaleSettingResourcePatch.cs
@@ -0,0 +1,137 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The autoscale setting object for patch operations.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class AutoscaleSettingResourcePatch
+ {
+ ///
+ /// Initializes a new instance of the AutoscaleSettingResourcePatch
+ /// class.
+ ///
+ public AutoscaleSettingResourcePatch()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the AutoscaleSettingResourcePatch
+ /// class.
+ ///
+ /// the collection of automatic scaling profiles
+ /// that specify different scaling parameters for different time
+ /// periods. A maximum of 20 profiles can be specified.
+ /// Resource tags
+ /// the collection of
+ /// notifications.
+ /// the enabled flag. Specifies whether automatic
+ /// scaling is enabled for the resource. The default value is
+ /// 'true'.
+ /// the name of the autoscale setting.
+ /// the resource identifier of the
+ /// resource that the autoscale setting should be added to.
+ public AutoscaleSettingResourcePatch(IList profiles, IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string))
+ {
+ Tags = tags;
+ Profiles = profiles;
+ Notifications = notifications;
+ Enabled = enabled;
+ Name = name;
+ TargetResourceUri = targetResourceUri;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the collection of automatic scaling profiles that
+ /// specify different scaling parameters for different time periods. A
+ /// maximum of 20 profiles can be specified.
+ ///
+ [JsonProperty(PropertyName = "properties.profiles")]
+ public IList Profiles { get; set; }
+
+ ///
+ /// Gets or sets the collection of notifications.
+ ///
+ [JsonProperty(PropertyName = "properties.notifications")]
+ public IList Notifications { get; set; }
+
+ ///
+ /// Gets or sets the enabled flag. Specifies whether automatic scaling
+ /// is enabled for the resource. The default value is 'true'.
+ ///
+ [JsonProperty(PropertyName = "properties.enabled")]
+ public bool? Enabled { get; set; }
+
+ ///
+ /// Gets or sets the name of the autoscale setting.
+ ///
+ [JsonProperty(PropertyName = "properties.name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the resource identifier of the resource that the
+ /// autoscale setting should be added to.
+ ///
+ [JsonProperty(PropertyName = "properties.targetResourceUri")]
+ public string TargetResourceUri { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Profiles == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Profiles");
+ }
+ if (Profiles != null)
+ {
+ if (Profiles.Count > 20)
+ {
+ throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20);
+ }
+ foreach (var element in Profiles)
+ {
+ if (element != null)
+ {
+ element.Validate();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ComparisonOperationType.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ComparisonOperationType.cs
index 2184b893c906..f76142fac19a 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ComparisonOperationType.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ComparisonOperationType.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -36,4 +36,49 @@ public enum ComparisonOperationType
[EnumMember(Value = "LessThanOrEqual")]
LessThanOrEqual
}
+ internal static class ComparisonOperationTypeEnumExtension
+ {
+ internal static string ToSerializedValue(this ComparisonOperationType? value) =>
+ value == null ? null : ((ComparisonOperationType)value).ToSerializedValue();
+
+ internal static string ToSerializedValue(this ComparisonOperationType value)
+ {
+ switch( value )
+ {
+ case ComparisonOperationType.Equals:
+ return "Equals";
+ case ComparisonOperationType.NotEquals:
+ return "NotEquals";
+ case ComparisonOperationType.GreaterThan:
+ return "GreaterThan";
+ case ComparisonOperationType.GreaterThanOrEqual:
+ return "GreaterThanOrEqual";
+ case ComparisonOperationType.LessThan:
+ return "LessThan";
+ case ComparisonOperationType.LessThanOrEqual:
+ return "LessThanOrEqual";
+ }
+ return null;
+ }
+
+ internal static ComparisonOperationType? ParseComparisonOperationType(this string value)
+ {
+ switch( value )
+ {
+ case "Equals":
+ return ComparisonOperationType.Equals;
+ case "NotEquals":
+ return ComparisonOperationType.NotEquals;
+ case "GreaterThan":
+ return ComparisonOperationType.GreaterThan;
+ case "GreaterThanOrEqual":
+ return ComparisonOperationType.GreaterThanOrEqual;
+ case "LessThan":
+ return ComparisonOperationType.LessThan;
+ case "LessThanOrEqual":
+ return ComparisonOperationType.LessThanOrEqual;
+ }
+ return null;
+ }
+ }
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ConditionOperator.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ConditionOperator.cs
index 3ef16b35bf3e..730b548d0940 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ConditionOperator.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ConditionOperator.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -32,4 +32,41 @@ public enum ConditionOperator
[EnumMember(Value = "LessThanOrEqual")]
LessThanOrEqual
}
+ internal static class ConditionOperatorEnumExtension
+ {
+ internal static string ToSerializedValue(this ConditionOperator? value) =>
+ value == null ? null : ((ConditionOperator)value).ToSerializedValue();
+
+ internal static string ToSerializedValue(this ConditionOperator value)
+ {
+ switch( value )
+ {
+ case ConditionOperator.GreaterThan:
+ return "GreaterThan";
+ case ConditionOperator.GreaterThanOrEqual:
+ return "GreaterThanOrEqual";
+ case ConditionOperator.LessThan:
+ return "LessThan";
+ case ConditionOperator.LessThanOrEqual:
+ return "LessThanOrEqual";
+ }
+ return null;
+ }
+
+ internal static ConditionOperator? ParseConditionOperator(this string value)
+ {
+ switch( value )
+ {
+ case "GreaterThan":
+ return ConditionOperator.GreaterThan;
+ case "GreaterThanOrEqual":
+ return ConditionOperator.GreaterThanOrEqual;
+ case "LessThan":
+ return ConditionOperator.LessThan;
+ case "LessThanOrEqual":
+ return ConditionOperator.LessThanOrEqual;
+ }
+ return null;
+ }
+ }
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailNotification.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailNotification.cs
index 7e1f1c8542d7..2e0a41b14557 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailNotification.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailNotification.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -25,7 +25,10 @@ public partial class EmailNotification
///
/// Initializes a new instance of the EmailNotification class.
///
- public EmailNotification() { }
+ public EmailNotification()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the EmailNotification class.
@@ -42,8 +45,14 @@ public EmailNotification() { }
SendToSubscriptionAdministrator = sendToSubscriptionAdministrator;
SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators;
CustomEmails = customEmails;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets a value indicating whether to send email to
/// subscription administrator.
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailReceiver.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailReceiver.cs
new file mode 100644
index 000000000000..74ea59154c67
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EmailReceiver.cs
@@ -0,0 +1,91 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An email receiver.
+ ///
+ public partial class EmailReceiver
+ {
+ ///
+ /// Initializes a new instance of the EmailReceiver class.
+ ///
+ public EmailReceiver()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EmailReceiver class.
+ ///
+ /// The name of the email receiver. Names must be
+ /// unique across all receivers within an action group.
+ /// The email address of this
+ /// receiver.
+ /// Possible values include: 'NotSpecified',
+ /// 'Enabled', 'Disabled'
+ public EmailReceiver(string name, string emailAddress, ReceiverStatus? status = default(ReceiverStatus?))
+ {
+ Name = name;
+ EmailAddress = emailAddress;
+ Status = status;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the email receiver. Names must be unique
+ /// across all receivers within an action group.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the email address of this receiver.
+ ///
+ [JsonProperty(PropertyName = "emailAddress")]
+ public string EmailAddress { get; set; }
+
+ ///
+ /// Gets possible values include: 'NotSpecified', 'Enabled', 'Disabled'
+ ///
+ [JsonProperty(PropertyName = "status")]
+ public ReceiverStatus? Status { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ if (EmailAddress == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "EmailAddress");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EnableRequest.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EnableRequest.cs
new file mode 100644
index 000000000000..9159921aaacc
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/EnableRequest.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Describes a receiver that should be resubscribed.
+ ///
+ public partial class EnableRequest
+ {
+ ///
+ /// Initializes a new instance of the EnableRequest class.
+ ///
+ public EnableRequest()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EnableRequest class.
+ ///
+ /// The name of the receiver to
+ /// resubscribe.
+ public EnableRequest(string receiverName)
+ {
+ ReceiverName = receiverName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the receiver to resubscribe.
+ ///
+ [JsonProperty(PropertyName = "receiverName")]
+ public string ReceiverName { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (ReceiverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ReceiverName");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponse.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponse.cs
index c753131d8a67..38e824a80ded 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponse.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponse.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -23,7 +23,10 @@ public partial class ErrorResponse
///
/// Initializes a new instance of the ErrorResponse class.
///
- public ErrorResponse() { }
+ public ErrorResponse()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the ErrorResponse class.
@@ -35,8 +38,14 @@ public ErrorResponse() { }
{
Code = code;
Message = message;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets error code
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponseException.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponseException.cs
index 78e8024f51fa..746eb871c4de 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponseException.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ErrorResponseException.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -18,9 +18,6 @@ namespace Microsoft.Azure.Management.Monitor.Management.Models
/// Exception thrown for an invalid response with ErrorResponse
/// information.
///
-#if LEGACY
- [System.Serializable]
-#endif
public class ErrorResponseException : RestException
{
///
@@ -63,39 +60,5 @@ public ErrorResponseException(string message, System.Exception innerException)
: base(message, innerException)
{
}
-
-#if LEGACY
- ///
- /// Initializes a new instance of the ErrorResponseException class.
- ///
- /// Serialization info.
- /// Streaming context.
- protected ErrorResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-
- ///
- /// Serializes content of the exception.
- ///
- /// Serialization info.
- /// Streaming context.
- ///
- /// Thrown when a required parameter is null
- ///
- [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- {
- base.GetObjectData(info, context);
- if (info == null)
- {
- throw new System.ArgumentNullException("info");
- }
-
- info.AddValue("Request", Request);
- info.AddValue("Response", Response);
- info.AddValue("Body", Body);
- }
-#endif
}
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/Incident.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/Incident.cs
index 8effcf3f8462..61558b61f733 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/Incident.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/Incident.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -23,7 +23,10 @@ public partial class Incident
///
/// Initializes a new instance of the Incident class.
///
- public Incident() { }
+ public Incident()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the Incident class.
@@ -45,8 +48,14 @@ public Incident() { }
IsActive = isActive;
ActivatedTime = activatedTime;
ResolvedTime = resolvedTime;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets incident name.
///
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LocationThresholdRuleCondition.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LocationThresholdRuleCondition.cs
index f215e8d9bf99..9e53d3de1325 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LocationThresholdRuleCondition.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LocationThresholdRuleCondition.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Monitor.Management.Models
using Microsoft.Azure.Management;
using Microsoft.Azure.Management.Monitor;
using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
@@ -25,7 +26,10 @@ public partial class LocationThresholdRuleCondition : RuleCondition
/// Initializes a new instance of the LocationThresholdRuleCondition
/// class.
///
- public LocationThresholdRuleCondition() { }
+ public LocationThresholdRuleCondition()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the LocationThresholdRuleCondition
@@ -45,8 +49,14 @@ public LocationThresholdRuleCondition() { }
{
WindowSize = windowSize;
FailedLocationCount = failedLocationCount;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the period of time (in ISO 8601 duration format) that
/// is used to monitor alert activity based on the threshold. If
@@ -65,12 +75,15 @@ public LocationThresholdRuleCondition() { }
///
/// Validate the object.
///
- ///
+ ///
/// Thrown if validation fails
///
public virtual void Validate()
{
- //Nothing to validate
+ if (FailedLocationCount < 0)
+ {
+ throw new ValidationException(ValidationRules.InclusiveMinimum, "FailedLocationCount", 0);
+ }
}
}
}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResource.cs
index c76ca0045be4..fa5ffe9fc05a 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResource.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResource.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -28,7 +28,10 @@ public partial class LogProfileResource : Resource
///
/// Initializes a new instance of the LogProfileResource class.
///
- public LogProfileResource() { }
+ public LogProfileResource()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the LogProfileResource class.
@@ -61,8 +64,14 @@ public LogProfileResource() { }
Locations = locations;
Categories = categories;
RetentionPolicy = retentionPolicy;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the resource id of the storage account to which you
/// would like to send the Activity Log.
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResourcePatch.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResourcePatch.cs
new file mode 100644
index 000000000000..8a8dfbbe7447
--- /dev/null
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogProfileResourcePatch.cs
@@ -0,0 +1,141 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Monitor.Management.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Monitor;
+ using Microsoft.Azure.Management.Monitor.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The log profile resource for patch operations.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class LogProfileResourcePatch
+ {
+ ///
+ /// Initializes a new instance of the LogProfileResourcePatch class.
+ ///
+ public LogProfileResourcePatch()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the LogProfileResourcePatch class.
+ ///
+ /// List of regions for which Activity Log
+ /// events should be stored or streamed. It is a comma separated list
+ /// of valid ARM locations including the 'global' location.
+ /// the categories of the logs. These
+ /// categories are created as is convenient to the user. Some values
+ /// are: 'Write', 'Delete', and/or 'Action.'
+ /// the retention policy for the events
+ /// in the log.
+ /// Resource tags
+ /// the resource id of the storage
+ /// account to which you would like to send the Activity Log.
+ /// The service bus rule ID of the
+ /// service bus namespace in which you would like to have Event Hubs
+ /// created for streaming the Activity Log. The rule ID is of the
+ /// format: '{service bus resource ID}/authorizationrules/{key
+ /// name}'.
+ public LogProfileResourcePatch(IList locations, IList categories, RetentionPolicy retentionPolicy, IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string))
+ {
+ Tags = tags;
+ StorageAccountId = storageAccountId;
+ ServiceBusRuleId = serviceBusRuleId;
+ Locations = locations;
+ Categories = categories;
+ RetentionPolicy = retentionPolicy;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the resource id of the storage account to which you
+ /// would like to send the Activity Log.
+ ///
+ [JsonProperty(PropertyName = "properties.storageAccountId")]
+ public string StorageAccountId { get; set; }
+
+ ///
+ /// Gets or sets the service bus rule ID of the service bus namespace
+ /// in which you would like to have Event Hubs created for streaming
+ /// the Activity Log. The rule ID is of the format: '{service bus
+ /// resource ID}/authorizationrules/{key name}'.
+ ///
+ [JsonProperty(PropertyName = "properties.serviceBusRuleId")]
+ public string ServiceBusRuleId { get; set; }
+
+ ///
+ /// Gets or sets list of regions for which Activity Log events should
+ /// be stored or streamed. It is a comma separated list of valid ARM
+ /// locations including the 'global' location.
+ ///
+ [JsonProperty(PropertyName = "properties.locations")]
+ public IList Locations { get; set; }
+
+ ///
+ /// Gets or sets the categories of the logs. These categories are
+ /// created as is convenient to the user. Some values are: 'Write',
+ /// 'Delete', and/or 'Action.'
+ ///
+ [JsonProperty(PropertyName = "properties.categories")]
+ public IList Categories { get; set; }
+
+ ///
+ /// Gets or sets the retention policy for the events in the log.
+ ///
+ [JsonProperty(PropertyName = "properties.retentionPolicy")]
+ public RetentionPolicy RetentionPolicy { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Locations == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Locations");
+ }
+ if (Categories == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Categories");
+ }
+ if (RetentionPolicy == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy");
+ }
+ if (RetentionPolicy != null)
+ {
+ RetentionPolicy.Validate();
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogSettings.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogSettings.cs
index 6be7f29a2b61..56ec479b513e 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogSettings.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/LogSettings.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -24,7 +24,10 @@ public partial class LogSettings
///
/// Initializes a new instance of the LogSettings class.
///
- public LogSettings() { }
+ public LogSettings()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the LogSettings class.
@@ -42,8 +45,14 @@ public LogSettings() { }
Category = category;
Enabled = enabled;
RetentionPolicy = retentionPolicy;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets name of a Diagnostic Log category for a resource type
/// this setting is applied to. To obtain the list of Diagnostic Log
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventAggregationCondition.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventAggregationCondition.cs
index e0c331d5442c..89d7c733f16e 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventAggregationCondition.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventAggregationCondition.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -24,7 +24,10 @@ public partial class ManagementEventAggregationCondition
/// Initializes a new instance of the
/// ManagementEventAggregationCondition class.
///
- public ManagementEventAggregationCondition() { }
+ public ManagementEventAggregationCondition()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the
@@ -44,8 +47,14 @@ public ManagementEventAggregationCondition() { }
OperatorProperty = operatorProperty;
Threshold = threshold;
WindowSize = windowSize;
+ CustomInit();
}
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
///
/// Gets or sets the condition operator. Possible values include:
/// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'
diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventRuleCondition.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventRuleCondition.cs
index 4ba6d03feba1..6f6e857ed2f5 100644
--- a/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventRuleCondition.cs
+++ b/src/SDKs/Monitor/Management.Monitor/Generated/Management/Monitor/Models/ManagementEventRuleCondition.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@@ -25,7 +25,10 @@ public partial class ManagementEventRuleCondition : RuleCondition
/// Initializes a new instance of the ManagementEventRuleCondition
/// class.
///
- public ManagementEventRuleCondition() { }
+ public ManagementEventRuleCondition()
+ {
+ CustomInit();
+ }
///
/// Initializes a new instance of the ManagementEventRuleCondition
@@ -42,8 +45,14 @@ public ManagementEventRuleCondition() { }
: base(dataSource)
{
Aggregation = aggregation;
+ CustomInit();
}
+ ///