diff --git a/src/SDKs/Monitor/AzSdk.RP.props b/src/SDKs/Monitor/AzSdk.RP.props index 48911c9b9bbd5..4d636c6a8b560 100644 --- a/src/SDKs/Monitor/AzSdk.RP.props +++ b/src/SDKs/Monitor/AzSdk.RP.props @@ -1,7 +1,7 @@ - Insights_2018-03-01;insights_2017-04-01;insights_2015-04-01;insights_2016-03-01;insights_2017-05-01-preview;insights_2017-11-01-preview;insights_2018-01-01;insights_2018-04-16; + Insights_2018-03-01;Insights_2018-11-27-preview;insights_2018-09-01;insights_2017-04-01;insights_2015-04-01;insights_2016-03-01;insights_2017-05-01-preview;insights_2017-11-01-preview;insights_2018-01-01;insights_2017-12-01-preview;insights_2018-04-16; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/ActionGroupsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/ActionGroupsOperations.cs index 24c5682079430..0851f41ee6709 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/ActionGroupsOperations.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/ActionGroupsOperations.cs @@ -105,7 +105,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +319,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -505,7 +505,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -684,7 +684,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupPatch"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -866,7 +866,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1044,7 +1044,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1237,7 +1237,7 @@ internal ActionGroupsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "receiverName"); } - string apiVersion = "2018-03-01"; + string apiVersion = "2018-09-01"; EnableRequest enableRequest = new EnableRequest(); if (receiverName != null) { diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/IMetricAlertsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/IMetricAlertsOperations.cs index c911c19fa704f..ec52f97ca1dc8 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/IMetricAlertsOperations.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/IMetricAlertsOperations.cs @@ -43,7 +43,7 @@ public partial interface IMetricAlertsOperations /// Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieve alert rule defintions in a resource group. + /// Retrieve alert rule definitions in a resource group. /// /// /// The name of the resource group. @@ -65,7 +65,7 @@ public partial interface IMetricAlertsOperations /// Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieve an alert rule definiton. + /// Retrieve an alert rule definition. /// /// /// The name of the resource group. @@ -146,7 +146,7 @@ public partial interface IMetricAlertsOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete an alert rule defitiniton. + /// Delete an alert rule definition. /// /// /// The name of the resource group. diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/IMetricNamespacesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/IMetricNamespacesOperations.cs new file mode 100644 index 0000000000000..79fbc89452627 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/IMetricNamespacesOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetricNamespacesOperations operations. + /// + public partial interface IMetricNamespacesOperations + { + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/IMonitorManagementClient.cs b/src/SDKs/Monitor/Management.Monitor/Generated/IMonitorManagementClient.cs index 9644c43ef3434..34dcec6b14304 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/IMonitorManagementClient.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/IMonitorManagementClient.cs @@ -154,5 +154,15 @@ public partial interface IMonitorManagementClient : System.IDisposable /// IScheduledQueryRulesOperations ScheduledQueryRules { get; } + /// + /// Gets the IMetricNamespacesOperations. + /// + IMetricNamespacesOperations MetricNamespaces { get; } + + /// + /// Gets the IVMInsightsOperations. + /// + IVMInsightsOperations VMInsights { get; } + } } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/IVMInsightsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/IVMInsightsOperations.cs new file mode 100644 index 0000000000000..bfae7b017527b --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/IVMInsightsOperations.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VMInsightsOperations operations. + /// + public partial interface IVMInsightsOperations + { + /// + /// Retrieves the VM Insights onboarding status for the specified + /// resource or resource scope. + /// + /// + /// The fully qualified Azure Resource manager identifier of the + /// resource, or scope, whose status to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOnboardingStatusWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperations.cs index 3c37481548785..212520cb0f36c 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperations.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperations.cs @@ -222,7 +222,7 @@ internal MetricAlertsOperations(MonitorManagementClient client) } /// - /// Retrieve alert rule defintions in a resource group. + /// Retrieve alert rule definitions in a resource group. /// /// /// The name of the resource group. @@ -402,7 +402,7 @@ internal MetricAlertsOperations(MonitorManagementClient client) } /// - /// Retrieve an alert rule definiton. + /// Retrieve an alert rule definition. /// /// /// The name of the resource group. @@ -1001,7 +1001,7 @@ internal MetricAlertsOperations(MonitorManagementClient client) } /// - /// Delete an alert rule defitiniton. + /// Delete an alert rule definition. /// /// /// The name of the resource group. diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperationsExtensions.cs index ba6c5599b9a18..9f8e6f9968a54 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperationsExtensions.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/MetricAlertsOperationsExtensions.cs @@ -52,7 +52,7 @@ public static IEnumerable ListBySubscription(this IMetricAl } /// - /// Retrieve alert rule defintions in a resource group. + /// Retrieve alert rule definitions in a resource group. /// /// /// The operations group for this extension method. @@ -66,7 +66,7 @@ public static IEnumerable ListByResourceGroup(this IMetricA } /// - /// Retrieve alert rule defintions in a resource group. + /// Retrieve alert rule definitions in a resource group. /// /// /// The operations group for this extension method. @@ -86,7 +86,7 @@ public static IEnumerable ListByResourceGroup(this IMetricA } /// - /// Retrieve an alert rule definiton. + /// Retrieve an alert rule definition. /// /// /// The operations group for this extension method. @@ -103,7 +103,7 @@ public static MetricAlertResource Get(this IMetricAlertsOperations operations, s } /// - /// Retrieve an alert rule definiton. + /// Retrieve an alert rule definition. /// /// /// The operations group for this extension method. @@ -218,7 +218,7 @@ public static MetricAlertResource Update(this IMetricAlertsOperations operations } /// - /// Delete an alert rule defitiniton. + /// Delete an alert rule definition. /// /// /// The operations group for this extension method. @@ -235,7 +235,7 @@ public static void Delete(this IMetricAlertsOperations operations, string resour } /// - /// Delete an alert rule defitiniton. + /// Delete an alert rule definition. /// /// /// The operations group for this extension method. diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/MetricNamespacesOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/MetricNamespacesOperations.cs new file mode 100644 index 0000000000000..8e73a78d2a25c --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/MetricNamespacesOperations.cs @@ -0,0 +1,238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 +{ + 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; + + /// + /// MetricNamespacesOperations operations. + /// + internal partial class MetricNamespacesOperations : IServiceOperations, IMetricNamespacesOperations + { + /// + /// Initializes a new instance of the MetricNamespacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricNamespacesOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2017-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceUri", resourceUri); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("startTime", startTime); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricNamespaces").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (startTime != null) + { + _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime))); + } + if (_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/MetricNamespacesOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/MetricNamespacesOperationsExtensions.cs new file mode 100644 index 0000000000000..bf67203b2baf2 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/MetricNamespacesOperationsExtensions.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 MetricNamespacesOperations. + /// + public static partial class MetricNamespacesOperationsExtensions + { + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + public static IEnumerable List(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string)) + { + return operations.ListAsync(resourceUri, startTime).GetAwaiter().GetResult(); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, startTime, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ActionGroupResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ActionGroupResource.cs index 4317bcb0e339c..20e0287652bca 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ActionGroupResource.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ActionGroupResource.cs @@ -63,7 +63,10 @@ public ActionGroupResource() /// that are part of this action group. /// The list of azure function /// 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), IList itsmReceivers = default(IList), IList azureAppPushReceivers = default(IList), IList automationRunbookReceivers = default(IList), IList voiceReceivers = default(IList), IList logicAppReceivers = default(IList), IList azureFunctionReceivers = default(IList)) + /// The list of ARM role receivers that + /// are part of this action group. Roles are Azure RBAC roles and only + /// built-in roles are supported. + 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), IList itsmReceivers = default(IList), IList azureAppPushReceivers = default(IList), IList automationRunbookReceivers = default(IList), IList voiceReceivers = default(IList), IList logicAppReceivers = default(IList), IList azureFunctionReceivers = default(IList), IList armRoleReceivers = default(IList)) : base(location, id, name, type, tags) { GroupShortName = groupShortName; @@ -77,6 +80,7 @@ public ActionGroupResource() VoiceReceivers = voiceReceivers; LogicAppReceivers = logicAppReceivers; AzureFunctionReceivers = azureFunctionReceivers; + ArmRoleReceivers = armRoleReceivers; CustomInit(); } @@ -163,6 +167,14 @@ public ActionGroupResource() [JsonProperty(PropertyName = "properties.azureFunctionReceivers")] public IList AzureFunctionReceivers { get; set; } + /// + /// Gets or sets the list of ARM role receivers that are part of this + /// action group. Roles are Azure RBAC roles and only built-in roles + /// are supported. + /// + [JsonProperty(PropertyName = "properties.armRoleReceivers")] + public IList ArmRoleReceivers { get; set; } + /// /// Validate the object. /// @@ -273,6 +285,16 @@ public override void Validate() } } } + if (ArmRoleReceivers != null) + { + foreach (var element9 in ArmRoleReceivers) + { + if (element9 != null) + { + element9.Validate(); + } + } + } } } } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/AlertingAction.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/AlertingAction.cs index c8e9e2054e8bf..31e2bc56ccfc7 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/AlertingAction.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/AlertingAction.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// Specifiy action need to be taken when rule type is Alert + /// Specify action need to be taken when rule type is Alert /// [Newtonsoft.Json.JsonObject("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction")] public partial class AlertingAction : Action @@ -33,12 +33,12 @@ public AlertingAction() /// /// Severity of the alert. Possible values /// include: '0', '1', '2', '3', '4' - /// Azure action group reference. /// The trigger condition that results in the /// alert rule being. + /// Azure action group reference. /// time (in minutes) for which Alerts /// should be throttled or suppressed. - public AlertingAction(string severity, AzNsActionGroup aznsAction, TriggerCondition trigger, int? throttlingInMin = default(int?)) + public AlertingAction(string severity, TriggerCondition trigger, AzNsActionGroup aznsAction = default(AzNsActionGroup), int? throttlingInMin = default(int?)) { Severity = severity; AznsAction = aznsAction; @@ -91,10 +91,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); } - if (AznsAction == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AznsAction"); - } if (Trigger == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Trigger"); diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ArmRoleReceiver.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ArmRoleReceiver.cs new file mode 100644 index 0000000000000..d9c0d05b51050 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ArmRoleReceiver.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An arm role receiver. + /// + public partial class ArmRoleReceiver + { + /// + /// Initializes a new instance of the ArmRoleReceiver class. + /// + public ArmRoleReceiver() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmRoleReceiver class. + /// + /// The name of the arm role receiver. Names must be + /// unique across all receivers within an action group. + /// The arm role id. + public ArmRoleReceiver(string name, string roleId) + { + Name = name; + RoleId = roleId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the arm role receiver. Names must be + /// unique across all receivers within an action group. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the arm role id. + /// + [JsonProperty(PropertyName = "roleId")] + public string RoleId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (RoleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RoleId"); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/AzNsActionGroup.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/AzNsActionGroup.cs index 5a8dadef71e59..e327bc653e779 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/AzNsActionGroup.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/AzNsActionGroup.cs @@ -35,7 +35,7 @@ public AzNsActionGroup() /// Custom subject override for all email /// ids in Azure action group /// Custom payload to be sent for - /// all webook URI in Azure action group + /// all webhook URI in Azure action group public AzNsActionGroup(IList actionGroup = default(IList), string emailSubject = default(string), string customWebhookPayload = default(string)) { ActionGroup = actionGroup; @@ -63,7 +63,7 @@ public AzNsActionGroup() public string EmailSubject { get; set; } /// - /// Gets or sets custom payload to be sent for all webook URI in Azure + /// Gets or sets custom payload to be sent for all webhook URI in Azure /// action group /// [JsonProperty(PropertyName = "customWebhookPayload")] diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/BaselineResponse.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/BaselineResponse.cs index e5ed2e9268425..cb3a7c95483f9 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/BaselineResponse.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/BaselineResponse.cs @@ -40,7 +40,7 @@ public BaselineResponse() /// the name and the display name of the metric, /// i.e. it is localizable string. /// The timespan for which the data was - /// retrieved. Its value consists of two datatimes concatenated, + /// retrieved. Its value consists of two datetimes concatenated, /// separated by '/'. This may be adjusted in the future and returned /// back from what was originally requested. /// The interval (window size) for which the @@ -94,7 +94,7 @@ public BaselineResponse() /// /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datatimes concatenated, separated by '/'. + /// value consists of two datetimes concatenated, separated by '/'. /// This may be adjusted in the future and returned back from what was /// originally requested. /// diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/CalculateBaselineResponse.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/CalculateBaselineResponse.cs index e3eb35f269f72..f635318ab02e1 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/CalculateBaselineResponse.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/CalculateBaselineResponse.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// The response to a calcualte baseline call. + /// The response to a calculate baseline call. /// public partial class CalculateBaselineResponse { diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Criteria.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Criteria.cs new file mode 100644 index 0000000000000..3de19395bf714 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Criteria.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the criteria for converting log to metric. + /// + public partial class Criteria + { + /// + /// Initializes a new instance of the Criteria class. + /// + public Criteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Criteria class. + /// + /// Name of the metric + /// List of Dimensions for creating + /// metric + public Criteria(string metricName, IList dimensions = default(IList)) + { + MetricName = metricName; + Dimensions = dimensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the metric + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets list of Dimensions for creating metric + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataContainer.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataContainer.cs new file mode 100644 index 0000000000000..07151405661a8 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataContainer.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a container with data for a given resource. + /// + public partial class DataContainer + { + /// + /// Initializes a new instance of the DataContainer class. + /// + public DataContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataContainer class. + /// + /// Log Analytics workspace + /// information. + public DataContainer(WorkspaceInfo workspace) + { + Workspace = workspace; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets log Analytics workspace information. + /// + [JsonProperty(PropertyName = "workspace")] + public WorkspaceInfo Workspace { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Workspace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Workspace"); + } + if (Workspace != null) + { + Workspace.Validate(); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataStatus.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataStatus.cs new file mode 100644 index 0000000000000..98b6052b4a7c5 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DataStatus.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for DataStatus. + /// + public static class DataStatus + { + public const string Present = "present"; + public const string NotPresent = "notPresent"; + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Dimension.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Dimension.cs new file mode 100644 index 0000000000000..239257fa94d4f --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Dimension.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the criteria for converting log to metric. + /// + public partial class Dimension + { + /// + /// Initializes a new instance of the Dimension class. + /// + public Dimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dimension class. + /// + /// Name of the dimension + /// List of dimension values + public Dimension(string name, IList values) + { + Name = name; + Values = values; + CustomInit(); + } + /// + /// Static constructor for Dimension class. + /// + static Dimension() + { + OperatorProperty = "Include"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the dimension + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets list of dimension values + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Operator for dimension values + /// + [JsonProperty(PropertyName = "operator")] + public static string OperatorProperty { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Error.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Error.cs new file mode 100644 index 0000000000000..3f7d8a71c50ff --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Error.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// Error code identifying the specific + /// error. + /// Error message in the caller's locale. + public Error(string code, string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code identifying the specific error. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message in the caller's locale. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogSearchRuleResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogSearchRuleResource.cs index e3145a6c63c72..e206d0bfb9e6b 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogSearchRuleResource.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogSearchRuleResource.cs @@ -37,8 +37,6 @@ public LogSearchRuleResource() /// Resource location /// Data Source against which rule will Query /// Data - /// Schedule (Frequnecy, Time Window) for - /// rule. /// Action needs to be taken on rule /// execution. /// Azure resource Id @@ -52,10 +50,12 @@ public LogSearchRuleResource() /// values include: 'true', 'false' /// Last time the rule was updated in /// IS08601 format. - /// Provisioning state of the - /// scheduledquery rule. Possible values include: 'Succeeded', - /// 'Deploying', 'Canceled', 'Failed' - public LogSearchRuleResource(string location, Source source, Schedule schedule, Action action, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string enabled = default(string), System.DateTime? lastUpdatedTime = default(System.DateTime?), string provisioningState = default(string)) + /// Provisioning state of the scheduled + /// query rule. Possible values include: 'Succeeded', 'Deploying', + /// 'Canceled', 'Failed' + /// Schedule (Frequency, Time Window) for rule. + /// Required for action type - AlertingAction + public LogSearchRuleResource(string location, Source source, Action action, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string enabled = default(string), System.DateTime? lastUpdatedTime = default(System.DateTime?), string provisioningState = default(string), Schedule schedule = default(Schedule)) : base(location, id, name, type, tags) { Description = description; @@ -94,8 +94,8 @@ public LogSearchRuleResource() public System.DateTime? LastUpdatedTime { get; private set; } /// - /// Gets provisioning state of the scheduledquery rule. Possible values - /// include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' + /// Gets provisioning state of the scheduled query rule. Possible + /// values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' /// [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } @@ -107,7 +107,8 @@ public LogSearchRuleResource() public Source Source { get; set; } /// - /// Gets or sets schedule (Frequnecy, Time Window) for rule. + /// Gets or sets schedule (Frequency, Time Window) for rule. Required + /// for action type - AlertingAction /// [JsonProperty(PropertyName = "properties.schedule")] public Schedule Schedule { get; set; } @@ -131,10 +132,6 @@ public override void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Source"); } - if (Schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); - } if (Action == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Action"); diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs new file mode 100644 index 0000000000000..0f81238fe0e58 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specify action need to be taken when rule type is converting log to + /// metric + /// + [Newtonsoft.Json.JsonObject("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction")] + public partial class LogToMetricAction : Action + { + /// + /// Initializes a new instance of the LogToMetricAction class. + /// + public LogToMetricAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogToMetricAction class. + /// + /// Severity of the alert + public LogToMetricAction(Criteria criteria) + { + Criteria = criteria; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets severity of the alert + /// + [JsonProperty(PropertyName = "criteria")] + public Criteria Criteria { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Criteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); + } + if (Criteria != null) + { + Criteria.Validate(); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespace.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespace.cs new file mode 100644 index 0000000000000..6180e56c91f1f --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespace.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metric namespace class specifies the metadata for a metric namespace. + /// + public partial class MetricNamespace + { + /// + /// Initializes a new instance of the MetricNamespace class. + /// + public MetricNamespace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricNamespace class. + /// + /// The ID of the metricNamespace. + /// The type of the namespace. + /// The name of the namespace. + /// Properties which include the fully + /// qualified namespace name. + public MetricNamespace(string id = default(string), string type = default(string), string name = default(string), MetricNamespaceName properties = default(MetricNamespaceName)) + { + Id = id; + Type = type; + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID of the metricNamespace. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the type of the namespace. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the namespace. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets properties which include the fully qualified namespace + /// name. + /// + [JsonProperty(PropertyName = "properties")] + public MetricNamespaceName Properties { get; set; } + + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespaceName.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespaceName.cs new file mode 100644 index 0000000000000..1415eb1300a4c --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricNamespaceName.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The fully qualified metric namespace name. + /// + public partial class MetricNamespaceName + { + /// + /// Initializes a new instance of the MetricNamespaceName class. + /// + public MetricNamespaceName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricNamespaceName class. + /// + /// The metric namespace + /// name. + public MetricNamespaceName(string metricNamespaceNameProperty = default(string)) + { + MetricNamespaceNameProperty = metricNamespaceNameProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric namespace name. + /// + [JsonProperty(PropertyName = "metricNamespaceName")] + public string MetricNamespaceNameProperty { get; set; } + + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricTrigger.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricTrigger.cs index 6dcf352ce1b1d..5a5ca0117caec 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricTrigger.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricTrigger.cs @@ -48,7 +48,7 @@ public MetricTrigger() /// time aggregation type. How the data /// that is collected should be combined over time. The default value /// is Average. Possible values include: 'Average', 'Minimum', - /// 'Maximum', 'Total', 'Count' + /// 'Maximum', 'Total', 'Count', 'Last' /// the operator that is used to compare /// the metric data and the threshold. Possible values include: /// 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', @@ -116,7 +116,7 @@ public MetricTrigger(string metricName, string metricResourceUri, System.TimeSpa /// Gets or sets time aggregation type. How the data that is collected /// should be combined over time. The default value is Average. /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', - /// 'Count' + /// 'Count', 'Last' /// [JsonProperty(PropertyName = "timeAggregation")] public TimeAggregationType TimeAggregation { get; set; } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/OnboardingStatus.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/OnboardingStatus.cs new file mode 100644 index 0000000000000..fe77b339b6df9 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/OnboardingStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for OnboardingStatus. + /// + public static class OnboardingStatus + { + public const string Onboarded = "onboarded"; + public const string NotOnboarded = "notOnboarded"; + public const string Unknown = "unknown"; + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ProxyResource.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..18a5c4e49cde8 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ProxyResource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/RecurrentSchedule.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/RecurrentSchedule.cs index b6f810f83b62f..5003472be5035 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/RecurrentSchedule.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/RecurrentSchedule.cs @@ -33,7 +33,7 @@ public RecurrentSchedule() /// Initializes a new instance of the RecurrentSchedule class. /// /// the timezone for the hours of the profile. - /// Some examples of valid timezones are: Dateline Standard Time, + /// Some examples of valid time zones are: Dateline Standard Time, /// UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific /// Standard Time (Mexico), Pacific Standard Time, US Mountain Standard /// Time, Mountain Standard Time (Mexico), Mountain Standard Time, @@ -98,7 +98,7 @@ public RecurrentSchedule(string timeZone, IList days, IList hours, /// /// Gets or sets the timezone for the hours of the profile. Some - /// examples of valid timezones are: Dateline Standard Time, UTC-11, + /// examples of valid time zones are: Dateline Standard Time, UTC-11, /// Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard /// Time (Mexico), Pacific Standard Time, US Mountain Standard Time, /// Mountain Standard Time (Mexico), Mountain Standard Time, Central diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Response.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Response.cs index 3315dfe9223f5..93627a8a00db1 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Response.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Response.cs @@ -33,7 +33,7 @@ public Response() /// Initializes a new instance of the Response class. /// /// The timespan for which the data was - /// retrieved. Its value consists of two datatimes concatenated, + /// retrieved. Its value consists of two datetimes concatenated, /// separated by '/'. This may be adjusted in the future and returned /// back from what was originally requested. /// the value of the collection. @@ -72,7 +72,7 @@ public Response() /// /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datatimes concatenated, separated by '/'. + /// value consists of two datetimes concatenated, separated by '/'. /// This may be adjusted in the future and returned back from what was /// originally requested. /// diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithError.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithError.cs new file mode 100644 index 0000000000000..833cc30f86bd4 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithError.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error response from the API. + /// + public partial class ResponseWithError + { + /// + /// Initializes a new instance of the ResponseWithError class. + /// + public ResponseWithError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResponseWithError class. + /// + /// Error information. + public ResponseWithError(Error error) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error information. + /// + [JsonProperty(PropertyName = "error")] + public Error Error { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Error == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Error"); + } + if (Error != null) + { + Error.Validate(); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithErrorException.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithErrorException.cs new file mode 100644 index 0000000000000..967932a47a430 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/ResponseWithErrorException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ResponseWithError + /// information. + /// + public partial class ResponseWithErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ResponseWithError Body { get; set; } + + /// + /// Initializes a new instance of the ResponseWithErrorException class. + /// + public ResponseWithErrorException() + { + } + + /// + /// Initializes a new instance of the ResponseWithErrorException class. + /// + /// The exception message. + public ResponseWithErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ResponseWithErrorException class. + /// + /// The exception message. + /// Inner exception. + public ResponseWithErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Source.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Source.cs index aaa75e925debc..065bdce85e150 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/Source.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/Source.cs @@ -32,14 +32,15 @@ public Source() /// /// Initializes a new instance of the Source class. /// - /// Log search query. /// The resource uri over which log search /// query is to be run. + /// Log search query. Required for action type - + /// AlertingAction /// List of Resource referred into /// query /// Set value to 'ResultCount'. Possible values /// include: 'ResultCount' - public Source(string query, string dataSourceId, IList authorizedResources = default(IList), string queryType = default(string)) + public Source(string dataSourceId, string query = default(string), IList authorizedResources = default(IList), string queryType = default(string)) { Query = query; AuthorizedResources = authorizedResources; @@ -54,7 +55,8 @@ public Source() partial void CustomInit(); /// - /// Gets or sets log search query. + /// Gets or sets log search query. Required for action type - + /// AlertingAction /// [JsonProperty(PropertyName = "query")] public string Query { get; set; } @@ -87,10 +89,6 @@ public Source() /// public virtual void Validate() { - if (Query == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Query"); - } if (DataSourceId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceId"); diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeAggregationType.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeAggregationType.cs index 34185559b546a..771c356ab52e4 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeAggregationType.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeAggregationType.cs @@ -30,7 +30,9 @@ public enum TimeAggregationType [EnumMember(Value = "Total")] Total, [EnumMember(Value = "Count")] - Count + Count, + [EnumMember(Value = "Last")] + Last } internal static class TimeAggregationTypeEnumExtension { @@ -53,6 +55,8 @@ internal static string ToSerializedValue(this TimeAggregationType value) return "Total"; case TimeAggregationType.Count: return "Count"; + case TimeAggregationType.Last: + return "Last"; } return null; } @@ -71,6 +75,8 @@ internal static string ToSerializedValue(this TimeAggregationType value) return TimeAggregationType.Total; case "Count": return TimeAggregationType.Count; + case "Last": + return TimeAggregationType.Last; } return null; } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeWindow.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeWindow.cs index ce1fae9e1e130..6eba68156e24c 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeWindow.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/TimeWindow.cs @@ -34,7 +34,7 @@ public TimeWindow() /// the end time for the profile in ISO 8601 /// format. /// the timezone of the start and end times for - /// the profile. Some examples of valid timezones are: Dateline + /// the profile. Some examples of valid time zones are: Dateline /// Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard /// Time, Pacific Standard Time (Mexico), Pacific Standard Time, US /// Mountain Standard Time, Mountain Standard Time (Mexico), Mountain @@ -91,7 +91,7 @@ public TimeWindow() /// /// Gets or sets the timezone of the start and end times for the - /// profile. Some examples of valid timezones are: Dateline Standard + /// profile. Some examples of valid time zones are: Dateline Standard /// Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, /// Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain /// Standard Time, Mountain Standard Time (Mexico), Mountain Standard diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/VMInsightsOnboardingStatus.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/VMInsightsOnboardingStatus.cs new file mode 100644 index 0000000000000..d49ea50f62ff9 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/VMInsightsOnboardingStatus.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// VM Insights onboarding status for a resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class VMInsightsOnboardingStatus : ProxyResource + { + /// + /// Initializes a new instance of the VMInsightsOnboardingStatus class. + /// + public VMInsightsOnboardingStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMInsightsOnboardingStatus class. + /// + /// Azure Resource Manager identifier of the + /// resource whose onboarding status is being represented. + /// The onboarding status for the + /// resource. Note that, a higher level scope, e.g., resource group or + /// subscription, is considered onboarded if at least one resource + /// under it is onboarded. Possible values include: 'onboarded', + /// 'notOnboarded', 'unknown' + /// The status of VM Insights data from the + /// resource. When reported as `present` the data array will contain + /// information about the data containers to which data for the + /// specified resource is being routed. Possible values include: + /// 'present', 'notPresent' + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Containers that currently store VM Insights data + /// for the specified resource. + public VMInsightsOnboardingStatus(string resourceId, string onboardingStatus, string dataStatus, string id = default(string), string name = default(string), string type = default(string), IList data = default(IList)) + : base(id, name, type) + { + ResourceId = resourceId; + OnboardingStatus = onboardingStatus; + DataStatus = dataStatus; + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Resource Manager identifier of the resource + /// whose onboarding status is being represented. + /// + [JsonProperty(PropertyName = "properties.resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the onboarding status for the resource. Note that, a + /// higher level scope, e.g., resource group or subscription, is + /// considered onboarded if at least one resource under it is + /// onboarded. Possible values include: 'onboarded', 'notOnboarded', + /// 'unknown' + /// + [JsonProperty(PropertyName = "properties.onboardingStatus")] + public string OnboardingStatus { get; set; } + + /// + /// Gets or sets the status of VM Insights data from the resource. When + /// reported as `present` the data array will contain information about + /// the data containers to which data for the specified resource is + /// being routed. Possible values include: 'present', 'notPresent' + /// + [JsonProperty(PropertyName = "properties.dataStatus")] + public string DataStatus { get; set; } + + /// + /// Gets or sets containers that currently store VM Insights data for + /// the specified resource. + /// + [JsonProperty(PropertyName = "properties.data")] + public IList Data { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (OnboardingStatus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OnboardingStatus"); + } + if (DataStatus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataStatus"); + } + if (Data != null) + { + foreach (var element in Data) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/WorkspaceInfo.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/WorkspaceInfo.cs new file mode 100644 index 0000000000000..e2a70bce08f20 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/WorkspaceInfo.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Log Analytics Workspace. + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkspaceInfo + { + /// + /// Initializes a new instance of the WorkspaceInfo class. + /// + public WorkspaceInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceInfo class. + /// + /// Azure Resource Manager identifier of the Log + /// Analytics Workspace. + /// Location of the Log Analytics + /// workspace. + /// Log Analytics workspace + /// identifier. + public WorkspaceInfo(string id, string location, string customerId) + { + Id = id; + Location = location; + CustomerId = customerId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Resource Manager identifier of the Log Analytics + /// Workspace. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets location of the Log Analytics workspace. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets log Analytics workspace identifier. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + if (CustomerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CustomerId"); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/MonitorManagementClient.cs b/src/SDKs/Monitor/Management.Monitor/Generated/MonitorManagementClient.cs index e7c18ac8e09be..b4b3b30f8bbdd 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/MonitorManagementClient.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/MonitorManagementClient.cs @@ -159,6 +159,16 @@ public partial class MonitorManagementClient : ServiceClient public virtual IScheduledQueryRulesOperations ScheduledQueryRules { get; private set; } + /// + /// Gets the IMetricNamespacesOperations. + /// + public virtual IMetricNamespacesOperations MetricNamespaces { get; private set; } + + /// + /// Gets the IVMInsightsOperations. + /// + public virtual IVMInsightsOperations VMInsights { get; private set; } + /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -418,6 +428,8 @@ private void Initialize() MetricAlerts = new MetricAlertsOperations(this); MetricAlertsStatus = new MetricAlertsStatusOperations(this); ScheduledQueryRules = new ScheduledQueryRulesOperations(this); + MetricNamespaces = new MetricNamespacesOperations(this); + VMInsights = new VMInsightsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -456,6 +468,8 @@ private void Initialize() DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("criterionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("criterionType")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); CustomInitialize(); diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/SdkInfo_MonitorClient.cs b/src/SDKs/Monitor/Management.Monitor/Generated/SdkInfo_MonitorClient.cs index b87bc48b22786..9520a3961e12f 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/SdkInfo_MonitorClient.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/SdkInfo_MonitorClient.cs @@ -21,7 +21,8 @@ public static IEnumerable> ApiInfo_MonitorClient { new Tuple("Insights", "MetricAlerts", "2018-03-01"), new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), - new Tuple("insights", "ActionGroups", "2018-03-01"), + new Tuple("Insights", "VMInsights", "2018-11-27-preview"), + new Tuple("insights", "ActionGroups", "2018-09-01"), new Tuple("insights", "ActivityLogAlerts", "2017-04-01"), new Tuple("insights", "ActivityLogs", "2015-04-01"), new Tuple("insights", "AlertRuleIncidents", "2016-03-01"), @@ -33,6 +34,7 @@ public static IEnumerable> ApiInfo_MonitorClient new Tuple("insights", "LogProfiles", "2016-03-01"), new Tuple("insights", "MetricBaseline", "2017-11-01-preview"), new Tuple("insights", "MetricDefinitions", "2018-01-01"), + new Tuple("insights", "MetricNamespaces", "2017-12-01-preview"), new Tuple("insights", "Metrics", "2018-01-01"), new Tuple("insights", "Operations", "2015-04-01"), new Tuple("insights", "ScheduledQueryRules", "2018-04-16"), diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/VMInsightsOperations.cs b/src/SDKs/Monitor/Management.Monitor/Generated/VMInsightsOperations.cs new file mode 100644 index 0000000000000..ff4927195499d --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/VMInsightsOperations.cs @@ -0,0 +1,231 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 +{ + 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; + + /// + /// VMInsightsOperations operations. + /// + internal partial class VMInsightsOperations : IServiceOperations, IVMInsightsOperations + { + /// + /// Initializes a new instance of the VMInsightsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VMInsightsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Retrieves the VM Insights onboarding status for the specified resource or + /// resource scope. + /// + /// + /// The fully qualified Azure Resource manager identifier of the resource, or + /// scope, whose status to retrieve. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOnboardingStatusWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2018-11-27-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceUri", resourceUri); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOnboardingStatus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + 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 ResponseWithErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResponseWithError _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/VMInsightsOperationsExtensions.cs b/src/SDKs/Monitor/Management.Monitor/Generated/VMInsightsOperationsExtensions.cs new file mode 100644 index 0000000000000..39a54983c5d8c --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/VMInsightsOperationsExtensions.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VMInsightsOperations. + /// + public static partial class VMInsightsOperationsExtensions + { + /// + /// Retrieves the VM Insights onboarding status for the specified resource or + /// resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The fully qualified Azure Resource manager identifier of the resource, or + /// scope, whose status to retrieve. + /// + public static VMInsightsOnboardingStatus GetOnboardingStatus(this IVMInsightsOperations operations, string resourceUri) + { + return operations.GetOnboardingStatusAsync(resourceUri).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the VM Insights onboarding status for the specified resource or + /// resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The fully qualified Azure Resource manager identifier of the resource, or + /// scope, whose status to retrieve. + /// + /// + /// The cancellation token. + /// + public static async Task GetOnboardingStatusAsync(this IVMInsightsOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOnboardingStatusWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}