From 3decb1c137f0b9cb8813158e17298e0b8adc054b Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Mon, 5 Oct 2020 15:45:00 -0500 Subject: [PATCH 1/7] Autorest codeGen; Removing Error*.cs models --- .../src/Generated/DataCollectionRules.cs | 1277 +++++++++++++++++ .../DataCollectionRulesExtensions.cs | 250 ++++ .../src/Generated/IDataCollectionRules.cs | 166 +++ .../src/Generated/IMonitorManagementClient.cs | 4 + .../Models/AzureMonitorMetricsDestination.cs | 82 ++ .../Generated/Models/DataCollectionRule.cs | 126 ++ .../Models/DataCollectionRuleDataSources.cs | 53 + .../Models/DataCollectionRuleDestinations.cs | 47 + .../Models/DataCollectionRuleResource.cs | 180 +++ .../DataCollectionRuleResourceListResult.cs | 84 ++ .../src/Generated/Models/DataFlow.cs | 76 + .../src/Generated/Models/DataSourcesSpec.cs | 80 ++ .../src/Generated/Models/DestinationsSpec.cs | 59 + .../DestinationsSpecAzureMonitorMetrics.cs | 54 + .../Generated/Models/ExtensionDataSource.cs | 140 ++ ...nownDataCollectionRuleProvisioningState.cs | 21 + .../Generated/Models/KnownDataFlowStreams.cs | 36 + .../Models/KnownExtensionDataSourceStreams.cs | 36 + ...ounterDataSourceScheduledTransferPeriod.cs | 21 + .../KnownPerfCounterDataSourceStreams.cs | 18 + .../KnownSyslogDataSourceFacilityNames.cs | 36 + .../Models/KnownSyslogDataSourceLogLevels.cs | 24 + .../Models/KnownSyslogDataSourceStreams.cs | 17 + ...entLogDataSourceScheduledTransferPeriod.cs | 22 + .../KnownWindowsEventLogDataSourceStreams.cs | 18 + .../Models/LogAnalyticsDestination.cs | 93 ++ .../Generated/Models/PerfCounterDataSource.cs | 158 ++ .../src/Generated/Models/ResourceForUpdate.cs | 50 + .../src/Generated/Models/SyslogDataSource.cs | 122 ++ .../Models/WindowsEventLogDataSource.cs | 132 ++ .../src/Generated/MonitorManagementClient.cs | 6 + 31 files changed, 3488 insertions(+) create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs new file mode 100644 index 0000000000000..2eeaf999a36b0 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -0,0 +1,1277 @@ +// +// Code generated 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 Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataCollectionRules operations. + /// + public partial class DataCollectionRules : IServiceOperations, IDataCollectionRules + { + /// + /// Initializes a new instance of the DataCollectionRules class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public DataCollectionRules(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 all data collection rules in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Returns the specified data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dataCollectionRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); + } + if (dataCollectionRuleName != null) + { + if (dataCollectionRuleName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); + } + if (dataCollectionRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + 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/dataCollectionRules/{dataCollectionRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dataCollectionRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); + } + if (dataCollectionRuleName != null) + { + if (dataCollectionRuleName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); + } + if (dataCollectionRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates part of a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dataCollectionRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); + } + if (dataCollectionRuleName != null) + { + if (dataCollectionRuleName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); + } + if (dataCollectionRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("body", body); + 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/dataCollectionRules/{dataCollectionRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dataCollectionRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); + } + if (dataCollectionRuleName != null) + { + if (dataCollectionRuleName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); + } + if (dataCollectionRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + 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/dataCollectionRules/{dataCollectionRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs new file mode 100644 index 0000000000000..6cbd06ef09d9a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs @@ -0,0 +1,250 @@ +// +// Code generated 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 Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataCollectionRules. + /// + public static partial class DataCollectionRulesExtensions + { + /// + /// Lists all data collection rules in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all data collection rules in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static DataCollectionRuleResourceListResult ListBySubscription(this IDataCollectionRules operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + public static DataCollectionRuleResource Get(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) + { + return operations.GetAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); + } + + /// + /// Returns the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + public static DataCollectionRuleResource Create(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource)) + { + return operations.CreateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates part of a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + public static DataCollectionRuleResource Update(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate)) + { + return operations.UpdateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); + } + + /// + /// Updates part of a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + public static void Delete(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) + { + operations.DeleteAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs new file mode 100644 index 0000000000000..c3d2a1349b118 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs @@ -0,0 +1,166 @@ +// +// Code generated 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 Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataCollectionRules operations. + /// + public partial interface IDataCollectionRules + { + /// + /// Lists all data collection rules in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the specified data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates part of a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// 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 dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs index 623025d9f1fb4..61f82e44b8cbe 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs @@ -194,5 +194,9 @@ public partial interface IMonitorManagementClient : System.IDisposable /// IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; } + /// + /// Gets the IDataCollectionRules. + /// + IDataCollectionRules DataCollectionRules { get; } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs new file mode 100644 index 0000000000000..4eac9eed65c5a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs @@ -0,0 +1,82 @@ +// +// Code generated 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; + + /// + /// Azure Monitor Metrics destination. + /// + public partial class AzureMonitorMetricsDestination + { + /// + /// Initializes a new instance of the AzureMonitorMetricsDestination + /// class. + /// + public AzureMonitorMetricsDestination() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureMonitorMetricsDestination + /// class. + /// + /// A friendly name for the destination. + /// This name should be unique across all destinations (regardless of + /// type) within the data collection rule. + public AzureMonitorMetricsDestination(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a friendly name for the destination. + /// This name should be unique across all destinations (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs new file mode 100644 index 0000000000000..454a02e3972bc --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs @@ -0,0 +1,126 @@ +// +// Code generated 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; + + /// + /// Definition of what monitoring data to collect and where that data + /// should be sent. + /// + public partial class DataCollectionRule + { + /// + /// Initializes a new instance of the DataCollectionRule class. + /// + public DataCollectionRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataCollectionRule class. + /// + /// The specification of + /// destinations. + /// The specification of data flows. + /// Description of the data collection + /// rule. + /// The specification of data sources. + /// This property is optional and can be omitted if the rule is meant + /// to be used via direct calls to the provisioned endpoint. + /// The resource provisioning state. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed' + public DataCollectionRule(DataCollectionRuleDestinations destinations, IList dataFlows, string description = default(string), DataCollectionRuleDataSources dataSources = default(DataCollectionRuleDataSources), string provisioningState = default(string)) + { + Description = description; + DataSources = dataSources; + Destinations = destinations; + DataFlows = dataFlows; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the data collection rule. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the specification of data sources. + /// This property is optional and can be omitted if the rule is meant + /// to be used via direct calls to the provisioned endpoint. + /// + [JsonProperty(PropertyName = "dataSources")] + public DataCollectionRuleDataSources DataSources { get; set; } + + /// + /// Gets or sets the specification of destinations. + /// + [JsonProperty(PropertyName = "destinations")] + public DataCollectionRuleDestinations Destinations { get; set; } + + /// + /// Gets or sets the specification of data flows. + /// + [JsonProperty(PropertyName = "dataFlows")] + public IList DataFlows { get; set; } + + /// + /// Gets the resource provisioning state. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Destinations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); + } + if (DataFlows == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataFlows"); + } + if (Description != null) + { + if (Description.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 256); + } + } + if (DataFlows != null) + { + foreach (var element in DataFlows) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs new file mode 100644 index 0000000000000..a8f31f4b717d3 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs @@ -0,0 +1,53 @@ +// +// Code generated 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 System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The specification of data sources. + /// This property is optional and can be omitted if the rule is meant to be + /// used via direct calls to the provisioned endpoint. + /// + public partial class DataCollectionRuleDataSources : DataSourcesSpec + { + /// + /// Initializes a new instance of the DataCollectionRuleDataSources + /// class. + /// + public DataCollectionRuleDataSources() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataCollectionRuleDataSources + /// class. + /// + /// The list of performance counter + /// data source configurations. + /// The list of Windows Event Log data + /// source configurations. + /// The list of Syslog data source + /// configurations. + /// The list of Azure VM extension data source + /// configurations. + public DataCollectionRuleDataSources(IList performanceCounters = default(IList), IList windowsEventLogs = default(IList), IList syslog = default(IList), IList extensions = default(IList)) + : base(performanceCounters, windowsEventLogs, syslog, extensions) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs new file mode 100644 index 0000000000000..99cb30cf99024 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs @@ -0,0 +1,47 @@ +// +// Code generated 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 System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The specification of destinations. + /// + public partial class DataCollectionRuleDestinations : DestinationsSpec + { + /// + /// Initializes a new instance of the DataCollectionRuleDestinations + /// class. + /// + public DataCollectionRuleDestinations() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataCollectionRuleDestinations + /// class. + /// + /// List of Log Analytics + /// destinations. + /// Azure Monitor Metrics + /// destination. + public DataCollectionRuleDestinations(IList logAnalytics = default(IList), DestinationsSpecAzureMonitorMetrics azureMonitorMetrics = default(DestinationsSpecAzureMonitorMetrics)) + : base(logAnalytics, azureMonitorMetrics) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs new file mode 100644 index 0000000000000..32a7615ae291e --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs @@ -0,0 +1,180 @@ +// +// Code generated 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; + + /// + /// Definition of ARM tracked top level resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DataCollectionRuleResource + { + /// + /// Initializes a new instance of the DataCollectionRuleResource class. + /// + public DataCollectionRuleResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataCollectionRuleResource class. + /// + /// The specification of + /// destinations. + /// The specification of data flows. + /// The geo-location where the resource + /// lives. + /// Description of the data collection + /// rule. + /// The specification of data sources. + /// This property is optional and can be omitted if the rule is meant + /// to be used via direct calls to the provisioned endpoint. + /// The resource provisioning state. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed' + /// Resource tags. + /// Fully qualified ID of the resource. + /// The name of the resource. + /// The type of the resource. + /// Resource entity tag (ETag). + public DataCollectionRuleResource(DataCollectionRuleDestinations destinations, IList dataFlows, string location, string description = default(string), DataCollectionRuleDataSources dataSources = default(DataCollectionRuleDataSources), string provisioningState = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Description = description; + DataSources = dataSources; + Destinations = destinations; + DataFlows = dataFlows; + ProvisioningState = provisioningState; + Location = location; + Tags = tags; + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the data collection rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the specification of data sources. + /// This property is optional and can be omitted if the rule is meant + /// to be used via direct calls to the provisioned endpoint. + /// + [JsonProperty(PropertyName = "properties.dataSources")] + public DataCollectionRuleDataSources DataSources { get; set; } + + /// + /// Gets or sets the specification of destinations. + /// + [JsonProperty(PropertyName = "properties.destinations")] + public DataCollectionRuleDestinations Destinations { get; set; } + + /// + /// Gets or sets the specification of data flows. + /// + [JsonProperty(PropertyName = "properties.dataFlows")] + public IList DataFlows { get; set; } + + /// + /// Gets the resource provisioning state. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets fully qualified ID of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource entity tag (ETag). + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Destinations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); + } + if (DataFlows == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataFlows"); + } + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + if (Description != null) + { + if (Description.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 256); + } + } + if (DataFlows != null) + { + foreach (var element in DataFlows) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs new file mode 100644 index 0000000000000..8802253e28253 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs @@ -0,0 +1,84 @@ +// +// Code generated 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; + + /// + /// A pageable list of resources. + /// + public partial class DataCollectionRuleResourceListResult + { + /// + /// Initializes a new instance of the + /// DataCollectionRuleResourceListResult class. + /// + public DataCollectionRuleResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DataCollectionRuleResourceListResult class. + /// + /// A list of resources. + /// The URL to use for getting the next set of + /// results. + public DataCollectionRuleResourceListResult(IList value, string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of resources. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URL to use for getting the next set of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (Value != null) + { + foreach (var element in Value) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs new file mode 100644 index 0000000000000..9415dd42828af --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs @@ -0,0 +1,76 @@ +// +// Code generated 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; + + /// + /// Definition of which streams are sent to which destinations. + /// + public partial class DataFlow + { + /// + /// Initializes a new instance of the DataFlow class. + /// + public DataFlow() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataFlow class. + /// + /// List of streams for this data flow. + /// List of destinations for this data + /// flow. + public DataFlow(IList streams, IList destinations) + { + Streams = streams; + Destinations = destinations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of streams for this data flow. + /// + [JsonProperty(PropertyName = "streams")] + public IList Streams { get; set; } + + /// + /// Gets or sets list of destinations for this data flow. + /// + [JsonProperty(PropertyName = "destinations")] + public IList Destinations { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Streams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); + } + if (Destinations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs new file mode 100644 index 0000000000000..f66eda00cfff0 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs @@ -0,0 +1,80 @@ +// +// Code generated 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specification of data sources that will be collected. + /// + public partial class DataSourcesSpec + { + /// + /// Initializes a new instance of the DataSourcesSpec class. + /// + public DataSourcesSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataSourcesSpec class. + /// + /// The list of performance counter + /// data source configurations. + /// The list of Windows Event Log data + /// source configurations. + /// The list of Syslog data source + /// configurations. + /// The list of Azure VM extension data source + /// configurations. + public DataSourcesSpec(IList performanceCounters = default(IList), IList windowsEventLogs = default(IList), IList syslog = default(IList), IList extensions = default(IList)) + { + PerformanceCounters = performanceCounters; + WindowsEventLogs = windowsEventLogs; + Syslog = syslog; + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of performance counter data source + /// configurations. + /// + [JsonProperty(PropertyName = "performanceCounters")] + public IList PerformanceCounters { get; set; } + + /// + /// Gets or sets the list of Windows Event Log data source + /// configurations. + /// + [JsonProperty(PropertyName = "windowsEventLogs")] + public IList WindowsEventLogs { get; set; } + + /// + /// Gets or sets the list of Syslog data source configurations. + /// + [JsonProperty(PropertyName = "syslog")] + public IList Syslog { get; set; } + + /// + /// Gets or sets the list of Azure VM extension data source + /// configurations. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs new file mode 100644 index 0000000000000..5288b0fb67ecb --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs @@ -0,0 +1,59 @@ +// +// Code generated 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specification of destinations that can be used in data flows. + /// + public partial class DestinationsSpec + { + /// + /// Initializes a new instance of the DestinationsSpec class. + /// + public DestinationsSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DestinationsSpec class. + /// + /// List of Log Analytics + /// destinations. + /// Azure Monitor Metrics + /// destination. + public DestinationsSpec(IList logAnalytics = default(IList), DestinationsSpecAzureMonitorMetrics azureMonitorMetrics = default(DestinationsSpecAzureMonitorMetrics)) + { + LogAnalytics = logAnalytics; + AzureMonitorMetrics = azureMonitorMetrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Log Analytics destinations. + /// + [JsonProperty(PropertyName = "logAnalytics")] + public IList LogAnalytics { get; set; } + + /// + /// Gets or sets azure Monitor Metrics destination. + /// + [JsonProperty(PropertyName = "azureMonitorMetrics")] + public DestinationsSpecAzureMonitorMetrics AzureMonitorMetrics { get; set; } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs new file mode 100644 index 0000000000000..93d723887d24e --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs @@ -0,0 +1,54 @@ +// +// Code generated 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 System.Linq; + + /// + /// Azure Monitor Metrics destination. + /// + public partial class DestinationsSpecAzureMonitorMetrics : AzureMonitorMetricsDestination + { + /// + /// Initializes a new instance of the + /// DestinationsSpecAzureMonitorMetrics class. + /// + public DestinationsSpecAzureMonitorMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DestinationsSpecAzureMonitorMetrics class. + /// + /// A friendly name for the destination. + /// This name should be unique across all destinations (regardless of + /// type) within the data collection rule. + public DestinationsSpecAzureMonitorMetrics(string name) + : base(name) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs new file mode 100644 index 0000000000000..1bc325e9906da --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs @@ -0,0 +1,140 @@ +// +// Code generated 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; + + /// + /// Definition of which data will be collected from a separate VM extension + /// that integrates with the Azure Monitor Agent. + /// Collected from either Windows and Linux machines, depending on which + /// extension is defined. + /// + public partial class ExtensionDataSource + { + /// + /// Initializes a new instance of the ExtensionDataSource class. + /// + public ExtensionDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtensionDataSource class. + /// + /// List of streams that this data source will be + /// sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent + /// to. + /// The name of the VM extension. + /// A friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// The extension settings. The format + /// is specific for particular extension. + public ExtensionDataSource(IList streams, string extensionName, string name, object extensionSettings = default(object)) + { + Streams = streams; + ExtensionName = extensionName; + ExtensionSettings = extensionSettings; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of streams that this data source will be sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent to. + /// + [JsonProperty(PropertyName = "streams")] + public IList Streams { get; set; } + + /// + /// Gets or sets the name of the VM extension. + /// + [JsonProperty(PropertyName = "extensionName")] + public string ExtensionName { get; set; } + + /// + /// Gets or sets the extension settings. The format is specific for + /// particular extension. + /// + [JsonProperty(PropertyName = "extensionSettings")] + public object ExtensionSettings { get; set; } + + /// + /// Gets or sets a friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Streams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); + } + if (ExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ExtensionName"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (ExtensionName != null) + { + if (ExtensionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "ExtensionName", 64); + } + if (ExtensionName.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "ExtensionName", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(ExtensionName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "ExtensionName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs new file mode 100644 index 0000000000000..5640026cd3136 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs @@ -0,0 +1,21 @@ +// +// Code generated 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 KnownDataCollectionRuleProvisioningState. + /// + public static class KnownDataCollectionRuleProvisioningState + { + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs new file mode 100644 index 0000000000000..065b72207306a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs @@ -0,0 +1,36 @@ +// +// Code generated 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 KnownDataFlowStreams. + /// + public static class KnownDataFlowStreams + { + public const string MicrosoftAntiMalwareStatus = "Microsoft-AntiMalwareStatus"; + public const string MicrosoftAuditd = "Microsoft-Auditd"; + public const string MicrosoftCISCOASA = "Microsoft-CISCOASA"; + public const string MicrosoftCommonSecurityLog = "Microsoft-CommonSecurityLog"; + public const string MicrosoftComputerGroup = "Microsoft-ComputerGroup"; + public const string MicrosoftEvent = "Microsoft-Event"; + public const string MicrosoftFirewallLog = "Microsoft-FirewallLog"; + public const string MicrosoftHealthStateChange = "Microsoft-HealthStateChange"; + public const string MicrosoftHeartbeat = "Microsoft-Heartbeat"; + public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; + public const string MicrosoftOperationLog = "Microsoft-OperationLog"; + public const string MicrosoftPerf = "Microsoft-Perf"; + public const string MicrosoftProcessInvestigator = "Microsoft-ProcessInvestigator"; + public const string MicrosoftProtectionStatus = "Microsoft-ProtectionStatus"; + public const string MicrosoftRomeDetectionEvent = "Microsoft-RomeDetectionEvent"; + public const string MicrosoftSecurityBaseline = "Microsoft-SecurityBaseline"; + public const string MicrosoftSecurityBaselineSummary = "Microsoft-SecurityBaselineSummary"; + public const string MicrosoftSecurityEvent = "Microsoft-SecurityEvent"; + public const string MicrosoftSyslog = "Microsoft-Syslog"; + public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs new file mode 100644 index 0000000000000..8dd2e7a0aba31 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs @@ -0,0 +1,36 @@ +// +// Code generated 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 KnownExtensionDataSourceStreams. + /// + public static class KnownExtensionDataSourceStreams + { + public const string MicrosoftAntiMalwareStatus = "Microsoft-AntiMalwareStatus"; + public const string MicrosoftAuditd = "Microsoft-Auditd"; + public const string MicrosoftCISCOASA = "Microsoft-CISCOASA"; + public const string MicrosoftCommonSecurityLog = "Microsoft-CommonSecurityLog"; + public const string MicrosoftComputerGroup = "Microsoft-ComputerGroup"; + public const string MicrosoftEvent = "Microsoft-Event"; + public const string MicrosoftFirewallLog = "Microsoft-FirewallLog"; + public const string MicrosoftHealthStateChange = "Microsoft-HealthStateChange"; + public const string MicrosoftHeartbeat = "Microsoft-Heartbeat"; + public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; + public const string MicrosoftOperationLog = "Microsoft-OperationLog"; + public const string MicrosoftPerf = "Microsoft-Perf"; + public const string MicrosoftProcessInvestigator = "Microsoft-ProcessInvestigator"; + public const string MicrosoftProtectionStatus = "Microsoft-ProtectionStatus"; + public const string MicrosoftRomeDetectionEvent = "Microsoft-RomeDetectionEvent"; + public const string MicrosoftSecurityBaseline = "Microsoft-SecurityBaseline"; + public const string MicrosoftSecurityBaselineSummary = "Microsoft-SecurityBaselineSummary"; + public const string MicrosoftSecurityEvent = "Microsoft-SecurityEvent"; + public const string MicrosoftSyslog = "Microsoft-Syslog"; + public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs new file mode 100644 index 0000000000000..c9592a0edf985 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs @@ -0,0 +1,21 @@ +// +// Code generated 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 KnownPerfCounterDataSourceScheduledTransferPeriod. + /// + public static class KnownPerfCounterDataSourceScheduledTransferPeriod + { + public const string PT1M = "PT1M"; + public const string PT5M = "PT5M"; + public const string PT15M = "PT15M"; + public const string PT30M = "PT30M"; + public const string PT60M = "PT60M"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs new file mode 100644 index 0000000000000..7a799f50bc2b8 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs @@ -0,0 +1,18 @@ +// +// Code generated 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 KnownPerfCounterDataSourceStreams. + /// + public static class KnownPerfCounterDataSourceStreams + { + public const string MicrosoftPerf = "Microsoft-Perf"; + public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs new file mode 100644 index 0000000000000..09faafba7b2c5 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs @@ -0,0 +1,36 @@ +// +// Code generated 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 KnownSyslogDataSourceFacilityNames. + /// + public static class KnownSyslogDataSourceFacilityNames + { + public const string Auth = "auth"; + public const string Authpriv = "authpriv"; + public const string Cron = "cron"; + public const string Daemon = "daemon"; + public const string Kern = "kern"; + public const string Lpr = "lpr"; + public const string Mail = "mail"; + public const string Mark = "mark"; + public const string News = "news"; + public const string Syslog = "syslog"; + public const string User = "user"; + public const string UUCP = "UUCP"; + public const string Local0 = "local0"; + public const string Local1 = "local1"; + public const string Local2 = "local2"; + public const string Local3 = "local3"; + public const string Local4 = "local4"; + public const string Local5 = "local5"; + public const string Local6 = "local6"; + public const string Local7 = "local7"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs new file mode 100644 index 0000000000000..a88501ccb697c --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs @@ -0,0 +1,24 @@ +// +// Code generated 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 KnownSyslogDataSourceLogLevels. + /// + public static class KnownSyslogDataSourceLogLevels + { + public const string Debug = "Debug"; + public const string Info = "Info"; + public const string Notice = "Notice"; + public const string Warning = "Warning"; + public const string Error = "Error"; + public const string Critical = "Critical"; + public const string Alert = "Alert"; + public const string Emergency = "Emergency"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs new file mode 100644 index 0000000000000..f55635df2a937 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs @@ -0,0 +1,17 @@ +// +// Code generated 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 KnownSyslogDataSourceStreams. + /// + public static class KnownSyslogDataSourceStreams + { + public const string MicrosoftSyslog = "Microsoft-Syslog"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs new file mode 100644 index 0000000000000..53d938db10e39 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs @@ -0,0 +1,22 @@ +// +// Code generated 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 + /// KnownWindowsEventLogDataSourceScheduledTransferPeriod. + /// + public static class KnownWindowsEventLogDataSourceScheduledTransferPeriod + { + public const string PT1M = "PT1M"; + public const string PT5M = "PT5M"; + public const string PT15M = "PT15M"; + public const string PT30M = "PT30M"; + public const string PT60M = "PT60M"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs new file mode 100644 index 0000000000000..f4615e9028786 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs @@ -0,0 +1,18 @@ +// +// Code generated 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 KnownWindowsEventLogDataSourceStreams. + /// + public static class KnownWindowsEventLogDataSourceStreams + { + public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; + public const string MicrosoftEvent = "Microsoft-Event"; + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs new file mode 100644 index 0000000000000..fc6aeb8b157a3 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs @@ -0,0 +1,93 @@ +// +// Code generated 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; + + /// + /// Log Analytics destination. + /// + public partial class LogAnalyticsDestination + { + /// + /// Initializes a new instance of the LogAnalyticsDestination class. + /// + public LogAnalyticsDestination() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsDestination class. + /// + /// The resource ID of the Log + /// Analytics workspace. + /// A friendly name for the destination. + /// This name should be unique across all destinations (regardless of + /// type) within the data collection rule. + public LogAnalyticsDestination(string workspaceResourceId, string name) + { + WorkspaceResourceId = workspaceResourceId; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the Log Analytics workspace. + /// + [JsonProperty(PropertyName = "workspaceResourceId")] + public string WorkspaceResourceId { get; set; } + + /// + /// Gets or sets a friendly name for the destination. + /// This name should be unique across all destinations (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WorkspaceResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkspaceResourceId"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs new file mode 100644 index 0000000000000..bd046924a9959 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs @@ -0,0 +1,158 @@ +// +// Code generated 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; + + /// + /// Definition of which performance counters will be collected and how they + /// will be collected by this data collection rule. + /// Collected from both Windows and Linux machines where the counter is + /// present. + /// + public partial class PerfCounterDataSource + { + /// + /// Initializes a new instance of the PerfCounterDataSource class. + /// + public PerfCounterDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PerfCounterDataSource class. + /// + /// List of streams that this data source will be + /// sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent + /// to. + /// The interval between data + /// uploads (scheduled transfers), rounded up to the nearest minute. + /// Possible values include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', + /// 'PT60M' + /// The number of seconds + /// between consecutive counter measurements (samples). + /// A list of specifier names of the + /// performance counters you want to collect. + /// Use a wildcard (*) to collect a counter for all instances. + /// To get a list of performance counters on Windows, run the command + /// 'typeperf'. + /// A friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + public PerfCounterDataSource(IList streams, string scheduledTransferPeriod, int samplingFrequencyInSeconds, IList counterSpecifiers, string name) + { + Streams = streams; + ScheduledTransferPeriod = scheduledTransferPeriod; + SamplingFrequencyInSeconds = samplingFrequencyInSeconds; + CounterSpecifiers = counterSpecifiers; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of streams that this data source will be sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent to. + /// + [JsonProperty(PropertyName = "streams")] + public IList Streams { get; set; } + + /// + /// Gets or sets the interval between data uploads (scheduled + /// transfers), rounded up to the nearest minute. Possible values + /// include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', 'PT60M' + /// + [JsonProperty(PropertyName = "scheduledTransferPeriod")] + public string ScheduledTransferPeriod { get; set; } + + /// + /// Gets or sets the number of seconds between consecutive counter + /// measurements (samples). + /// + [JsonProperty(PropertyName = "samplingFrequencyInSeconds")] + public int SamplingFrequencyInSeconds { get; set; } + + /// + /// Gets or sets a list of specifier names of the performance counters + /// you want to collect. + /// Use a wildcard (*) to collect a counter for all instances. + /// To get a list of performance counters on Windows, run the command + /// 'typeperf'. + /// + [JsonProperty(PropertyName = "counterSpecifiers")] + public IList CounterSpecifiers { get; set; } + + /// + /// Gets or sets a friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Streams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); + } + if (ScheduledTransferPeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScheduledTransferPeriod"); + } + if (CounterSpecifiers == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CounterSpecifiers"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (SamplingFrequencyInSeconds > 30) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "SamplingFrequencyInSeconds", 30); + } + if (SamplingFrequencyInSeconds < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "SamplingFrequencyInSeconds", 1); + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs new file mode 100644 index 0000000000000..5c42e64be82b1 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs @@ -0,0 +1,50 @@ +// +// Code generated 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Definition of ARM tracked top level resource properties for update + /// operation. + /// + public partial class ResourceForUpdate + { + /// + /// Initializes a new instance of the ResourceForUpdate class. + /// + public ResourceForUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceForUpdate class. + /// + /// Resource tags. + public ResourceForUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs new file mode 100644 index 0000000000000..d1078c00a6818 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs @@ -0,0 +1,122 @@ +// +// Code generated 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; + + /// + /// Definition of which syslog data will be collected and how it will be + /// collected. + /// Only collected from Linux machines. + /// + public partial class SyslogDataSource + { + /// + /// Initializes a new instance of the SyslogDataSource class. + /// + public SyslogDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SyslogDataSource class. + /// + /// List of streams that this data source will be + /// sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent + /// to. + /// The list of facility names. + /// A friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// The log levels to collect. + public SyslogDataSource(IList streams, IList facilityNames, string name, IList logLevels = default(IList)) + { + Streams = streams; + FacilityNames = facilityNames; + LogLevels = logLevels; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of streams that this data source will be sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent to. + /// + [JsonProperty(PropertyName = "streams")] + public IList Streams { get; set; } + + /// + /// Gets or sets the list of facility names. + /// + [JsonProperty(PropertyName = "facilityNames")] + public IList FacilityNames { get; set; } + + /// + /// Gets or sets the log levels to collect. + /// + [JsonProperty(PropertyName = "logLevels")] + public IList LogLevels { get; set; } + + /// + /// Gets or sets a friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Streams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); + } + if (FacilityNames == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FacilityNames"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs new file mode 100644 index 0000000000000..ee17d7f33d2a8 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs @@ -0,0 +1,132 @@ +// +// Code generated 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; + + /// + /// Definition of which Windows Event Log events will be collected and how + /// they will be collected. + /// Only collected from Windows machines. + /// + public partial class WindowsEventLogDataSource + { + /// + /// Initializes a new instance of the WindowsEventLogDataSource class. + /// + public WindowsEventLogDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsEventLogDataSource class. + /// + /// List of streams that this data source will be + /// sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent + /// to. + /// The interval between data + /// uploads (scheduled transfers), rounded up to the nearest minute. + /// Possible values include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', + /// 'PT60M' + /// A list of Windows Event Log queries in + /// XPATH format. + /// A friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + public WindowsEventLogDataSource(IList streams, string scheduledTransferPeriod, IList xPathQueries, string name) + { + Streams = streams; + ScheduledTransferPeriod = scheduledTransferPeriod; + XPathQueries = xPathQueries; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of streams that this data source will be sent to. + /// A stream indicates what schema will be used for this data and + /// usually what table in Log Analytics the data will be sent to. + /// + [JsonProperty(PropertyName = "streams")] + public IList Streams { get; set; } + + /// + /// Gets or sets the interval between data uploads (scheduled + /// transfers), rounded up to the nearest minute. Possible values + /// include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', 'PT60M' + /// + [JsonProperty(PropertyName = "scheduledTransferPeriod")] + public string ScheduledTransferPeriod { get; set; } + + /// + /// Gets or sets a list of Windows Event Log queries in XPATH format. + /// + [JsonProperty(PropertyName = "xPathQueries")] + public IList XPathQueries { get; set; } + + /// + /// Gets or sets a friendly name for the data source. + /// This name should be unique across all data sources (regardless of + /// type) within the data collection rule. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Streams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); + } + if (ScheduledTransferPeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScheduledTransferPeriod"); + } + if (XPathQueries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "XPathQueries"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Name != null) + { + if (Name.Length > 32) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 32); + } + if (Name.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 0); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs index 247e95185e8f6..49023273bd962 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs @@ -199,6 +199,11 @@ public partial class MonitorManagementClient : ServiceClient public virtual IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; private set; } + /// + /// Gets the IDataCollectionRules. + /// + public virtual IDataCollectionRules DataCollectionRules { get; private set; } + /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -466,6 +471,7 @@ private void Initialize() PrivateLinkResources = new PrivateLinkResourcesOperations(this); PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); + DataCollectionRules = new DataCollectionRules(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; From 5426b7a422338f5e159a0fd782d2ae0f3c31a7a4 Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Mon, 5 Oct 2020 15:55:41 -0500 Subject: [PATCH 2/7] Autorest DCR adjust: Set apiVersion to 219-11-01-preview in DCR --- .../src/Generated/DataCollectionRules.cs | 96 ++++--------------- 1 file changed, 18 insertions(+), 78 deletions(-) diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs index 2eeaf999a36b0..26ef86fce20bd 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -105,17 +105,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,9 +123,9 @@ public DataCollectionRules(MonitorManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -272,17 +262,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -298,9 +278,9 @@ public DataCollectionRules(MonitorManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -481,17 +461,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -511,9 +481,9 @@ public DataCollectionRules(MonitorManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -697,17 +667,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; if (body != null) { body.Validate(); @@ -732,9 +692,9 @@ public DataCollectionRules(MonitorManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -942,17 +902,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -973,9 +923,9 @@ public DataCollectionRules(MonitorManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1159,17 +1109,7 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); } } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1189,9 +1129,9 @@ public DataCollectionRules(MonitorManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { From 7a8f68a4f3ffc7a1f82e56e9362da1da0d62e2e7 Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Tue, 6 Oct 2020 10:25:09 -0500 Subject: [PATCH 3/7] DCR & DCRA --- .../DataCollectionRuleAssociations.cs | 980 ++++++++++++++++++ ...ataCollectionRuleAssociationsExtensions.cs | 217 ++++ .../src/Generated/DataCollectionRules.cs | 43 +- .../DataCollectionRulesExtensions.cs | 419 ++++---- .../IDataCollectionRuleAssociations.cs | 146 +++ .../src/Generated/IDataCollectionRules.cs | 2 + .../src/Generated/IMonitorManagementClient.cs | 5 + .../Models/AzureMonitorMetricsDestination.cs | 15 - .../Generated/Models/DataCollectionRule.cs | 7 - .../Models/DataCollectionRuleAssociation.cs | 85 ++ ...lectionRuleAssociationProxyOnlyResource.cs | 118 +++ ...eAssociationProxyOnlyResourceListResult.cs | 84 ++ .../Models/DataCollectionRuleResource.cs | 7 - .../Generated/Models/ExtensionDataSource.cs | 30 - ...nownDataCollectionRuleProvisioningState.cs | 21 - .../Generated/Models/KnownDataFlowStreams.cs | 36 - .../Models/KnownExtensionDataSourceStreams.cs | 36 - ...ounterDataSourceScheduledTransferPeriod.cs | 21 - .../KnownPerfCounterDataSourceStreams.cs | 18 - .../KnownSyslogDataSourceFacilityNames.cs | 36 - .../Models/KnownSyslogDataSourceLogLevels.cs | 24 - .../Models/KnownSyslogDataSourceStreams.cs | 17 - ...entLogDataSourceScheduledTransferPeriod.cs | 22 - .../KnownWindowsEventLogDataSourceStreams.cs | 18 - .../Models/LogAnalyticsDestination.cs | 15 - .../Generated/Models/PerfCounterDataSource.cs | 15 - .../src/Generated/Models/SyslogDataSource.cs | 15 - .../Models/WindowsEventLogDataSource.cs | 15 - .../src/Generated/MonitorManagementClient.cs | 7 + 29 files changed, 1880 insertions(+), 594 deletions(-) create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs new file mode 100644 index 0000000000000..7b50e203f6e62 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs @@ -0,0 +1,980 @@ +// +// Code generated 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 Models; + + using Newtonsoft.Json; + + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataCollectionRuleAssociations operations. + /// + public partial class DataCollectionRuleAssociations : IServiceOperations, IDataCollectionRuleAssociations + { + /// + /// Initializes a new instance of the DataCollectionRuleAssociations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public DataCollectionRuleAssociations(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 associations for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (resourceUri != null) + { + if (resourceUri.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); + } + } + string apiVersion = "2019-11-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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResource", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations").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 += "?" + 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 (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 associations for the specified data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dataCollectionRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); + } + if (dataCollectionRuleName != null) + { + if (dataCollectionRuleName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); + } + if (dataCollectionRuleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2019-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByRule", 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/dataCollectionRules/{dataCollectionRuleName}/associations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Returns the specified association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (resourceUri != null) + { + if (resourceUri.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); + } + } + if (associationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); + } + if (associationName != null) + { + if (associationName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); + } + if (associationName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "associationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2019-11-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("associationName", associationName); + 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("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The payload + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (resourceUri != null) + { + if (resourceUri.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); + } + } + if (associationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); + } + if (associationName != null) + { + if (associationName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); + } + if (associationName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "associationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2019-11-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("associationName", associationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if (body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// 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 resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (resourceUri != null) + { + if (resourceUri.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); + } + } + if (associationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); + } + if (associationName != null) + { + if (associationName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); + } + if (associationName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "associationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2019-11-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("associationName", associationName); + 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("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs new file mode 100644 index 0000000000000..f54df002f9d04 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs @@ -0,0 +1,217 @@ +// +// Code generated 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 Models; + + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataCollectionRuleAssociations. + /// + public static partial class DataCollectionRuleAssociationsExtensions + { + /// + /// Lists associations for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByResource(this IDataCollectionRuleAssociations operations, string resourceUri) + { + return operations.ListByResourceAsync(resourceUri).GetAwaiter().GetResult(); + } + + /// + /// Lists associations for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListByResourceAsync(this IDataCollectionRuleAssociations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists associations for the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByRule(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName) + { + return operations.ListByRuleAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); + } + + /// + /// Lists associations for the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task ListByRuleAsync(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByRuleWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the specified association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + public static DataCollectionRuleAssociationProxyOnlyResource Get(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName) + { + return operations.GetAsync(resourceUri, associationName).GetAwaiter().GetResult(); + } + + /// + /// Returns the specified association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, associationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The payload + /// + public static DataCollectionRuleAssociationProxyOnlyResource Create(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource)) + { + return operations.CreateAsync(resourceUri, associationName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The payload + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceUri, associationName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + public static void Delete(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName) + { + operations.DeleteAsync(resourceUri, associationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an association. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceUri, associationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs index 26ef86fce20bd..793620cb36d6b 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -7,8 +7,11 @@ namespace Microsoft.Azure.Management.Monitor { using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; using System.Collections.Generic; using System.IO; @@ -114,6 +117,7 @@ public DataCollectionRules(MonitorManagementClient client) _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); } @@ -141,7 +145,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -173,7 +177,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -270,6 +274,7 @@ public DataCollectionRules(MonitorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } @@ -296,7 +301,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -328,7 +333,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -471,6 +476,7 @@ public DataCollectionRules(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -499,7 +505,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -531,7 +537,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -667,11 +673,11 @@ public DataCollectionRules(MonitorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); } } - string apiVersion = "2019-11-01-preview"; if (body != null) { body.Validate(); } + string apiVersion = "2019-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -681,6 +687,7 @@ public DataCollectionRules(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); @@ -710,7 +717,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -722,11 +729,11 @@ public DataCollectionRules(MonitorManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if (body != null) { _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Send Request if (_shouldTrace) @@ -748,7 +755,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -912,6 +919,7 @@ public DataCollectionRules(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); @@ -941,7 +949,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -953,11 +961,11 @@ public DataCollectionRules(MonitorManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if (body != null) { _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Send Request if (_shouldTrace) @@ -979,7 +987,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1119,6 +1127,7 @@ public DataCollectionRules(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1147,7 +1156,7 @@ public DataCollectionRules(MonitorManagementClient client) if (customHeaders != null) { - foreach(var _header in customHeaders) + foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1179,7 +1188,7 @@ public DataCollectionRules(MonitorManagementClient client) try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs index 6cbd06ef09d9a..d20e2b8e68b75 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Management.Monitor { using Models; + using System.Threading; using System.Threading.Tasks; @@ -15,236 +16,236 @@ namespace Microsoft.Azure.Management.Monitor /// public static partial class DataCollectionRulesExtensions { - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } + /// + /// Lists all data collection rules in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists all data collection rules in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - public static DataCollectionRuleResourceListResult ListBySubscription(this IDataCollectionRules operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static DataCollectionRuleResourceListResult ListBySubscription(this IDataCollectionRules operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } - /// - /// Returns the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - public static DataCollectionRuleResource Get(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) - { - return operations.GetAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); - } + /// + /// Returns the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + public static DataCollectionRuleResource Get(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) + { + return operations.GetAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); + } - /// - /// Returns the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Returns the specified data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } - /// - /// Creates or updates a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - public static DataCollectionRuleResource Create(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource)) - { - return operations.CreateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); - } + /// + /// Creates or updates a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + public static DataCollectionRuleResource Create(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource)) + { + return operations.CreateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); + } - /// - /// Creates or updates a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Creates or updates a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } - /// - /// Updates part of a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - public static DataCollectionRuleResource Update(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate)) - { - return operations.UpdateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); - } + /// + /// Updates part of a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + public static DataCollectionRuleResource Update(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate)) + { + return operations.UpdateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); + } - /// - /// Updates part of a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Updates part of a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The payload + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } - /// - /// Deletes a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - public static void Delete(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) - { - operations.DeleteAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); - } + /// + /// Deletes a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + public static void Delete(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) + { + operations.DeleteAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); + } - /// - /// Deletes a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Deletes a data collection rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs new file mode 100644 index 0000000000000..4175e4c4490d3 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs @@ -0,0 +1,146 @@ +// +// Code generated 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 Models; + + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataCollectionRuleAssociations operations. + /// + public partial interface IDataCollectionRuleAssociations + { + /// + /// Lists associations for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists associations for the specified data collection rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the specified association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// 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 resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// The payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an association. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the association. + /// + /// + /// 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 resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs index c3d2a1349b118..d9b5c0af5cefb 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs @@ -7,7 +7,9 @@ namespace Microsoft.Azure.Management.Monitor { using Microsoft.Rest; + using Models; + using System.Collections; using System.Collections.Generic; using System.Threading; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs index 61f82e44b8cbe..dc566c7a40578 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs @@ -198,5 +198,10 @@ public partial interface IMonitorManagementClient : System.IDisposable /// Gets the IDataCollectionRules. /// IDataCollectionRules DataCollectionRules { get; } + + /// + /// Gets the IDataCollectionRuleAssociations. + /// + IDataCollectionRuleAssociations DataCollectionRuleAssociations { get; } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs index 4eac9eed65c5a..024b31b45b870 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs @@ -62,21 +62,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs index 454a02e3972bc..ebffbf57361e7 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs @@ -104,13 +104,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DataFlows"); } - if (Description != null) - { - if (Description.Length > 256) - { - throw new ValidationException(ValidationRules.MaxLength, "Description", 256); - } - } if (DataFlows != null) { foreach (var element in DataFlows) diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs new file mode 100644 index 0000000000000..0775f9fb50e1a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs @@ -0,0 +1,85 @@ +// +// Code generated 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; + + /// + /// Definition of association of a data collection rule with a monitored + /// Azure resource. + /// + public partial class DataCollectionRuleAssociation + { + /// + /// Initializes a new instance of the DataCollectionRuleAssociation + /// class. + /// + public DataCollectionRuleAssociation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataCollectionRuleAssociation + /// class. + /// + /// The resource ID of the data + /// collection rule that is to be associated. + /// Description of the association. + /// The resource provisioning state. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed' + public DataCollectionRuleAssociation(string dataCollectionRuleId, string description = default(string), string provisioningState = default(string)) + { + Description = description; + DataCollectionRuleId = dataCollectionRuleId; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the association. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the resource ID of the data collection rule that is to + /// be associated. + /// + [JsonProperty(PropertyName = "dataCollectionRuleId")] + public string DataCollectionRuleId { get; set; } + + /// + /// Gets the resource provisioning state. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataCollectionRuleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataCollectionRuleId"); + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs new file mode 100644 index 0000000000000..b7f96e14d17bd --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs @@ -0,0 +1,118 @@ +// +// Code generated 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; + + /// + /// Definition of generic ARM proxy resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DataCollectionRuleAssociationProxyOnlyResource + { + /// + /// Initializes a new instance of the + /// DataCollectionRuleAssociationProxyOnlyResource class. + /// + public DataCollectionRuleAssociationProxyOnlyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DataCollectionRuleAssociationProxyOnlyResource class. + /// + /// The resource ID of the data + /// collection rule that is to be associated. + /// Description of the association. + /// The resource provisioning state. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed' + /// Fully qualified ID of the resource. + /// The name of the resource. + /// The type of the resource. + /// Resource entity tag (ETag). + public DataCollectionRuleAssociationProxyOnlyResource(string dataCollectionRuleId, string description = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Description = description; + DataCollectionRuleId = dataCollectionRuleId; + ProvisioningState = provisioningState; + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the association. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the resource ID of the data collection rule that is to + /// be associated. + /// + [JsonProperty(PropertyName = "properties.dataCollectionRuleId")] + public string DataCollectionRuleId { get; set; } + + /// + /// Gets the resource provisioning state. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets fully qualified ID of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource entity tag (ETag). + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataCollectionRuleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataCollectionRuleId"); + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs new file mode 100644 index 0000000000000..53a80a1e277c3 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs @@ -0,0 +1,84 @@ +// +// Code generated 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; + + /// + /// A pageable list of resources. + /// + public partial class DataCollectionRuleAssociationProxyOnlyResourceListResult + { + /// + /// Initializes a new instance of the + /// DataCollectionRuleAssociationProxyOnlyResourceListResult class. + /// + public DataCollectionRuleAssociationProxyOnlyResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DataCollectionRuleAssociationProxyOnlyResourceListResult class. + /// + /// A list of resources. + /// The URL to use for getting the next set of + /// results. + public DataCollectionRuleAssociationProxyOnlyResourceListResult(IList value, string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of resources. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URL to use for getting the next set of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (Value != null) + { + foreach (var element in Value) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs index 32a7615ae291e..1cc8edd0e670e 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs @@ -158,13 +158,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } - if (Description != null) - { - if (Description.Length > 256) - { - throw new ValidationException(ValidationRules.MaxLength, "Description", 256); - } - } if (DataFlows != null) { foreach (var element in DataFlows) diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs index 1bc325e9906da..be46e72de05a5 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs @@ -105,36 +105,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (ExtensionName != null) - { - if (ExtensionName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "ExtensionName", 64); - } - if (ExtensionName.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "ExtensionName", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(ExtensionName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "ExtensionName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs deleted file mode 100644 index 5640026cd3136..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataCollectionRuleProvisioningState.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// Code generated 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 KnownDataCollectionRuleProvisioningState. - /// - public static class KnownDataCollectionRuleProvisioningState - { - public const string Creating = "Creating"; - public const string Updating = "Updating"; - public const string Deleting = "Deleting"; - public const string Succeeded = "Succeeded"; - public const string Failed = "Failed"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs deleted file mode 100644 index 065b72207306a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownDataFlowStreams.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Code generated 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 KnownDataFlowStreams. - /// - public static class KnownDataFlowStreams - { - public const string MicrosoftAntiMalwareStatus = "Microsoft-AntiMalwareStatus"; - public const string MicrosoftAuditd = "Microsoft-Auditd"; - public const string MicrosoftCISCOASA = "Microsoft-CISCOASA"; - public const string MicrosoftCommonSecurityLog = "Microsoft-CommonSecurityLog"; - public const string MicrosoftComputerGroup = "Microsoft-ComputerGroup"; - public const string MicrosoftEvent = "Microsoft-Event"; - public const string MicrosoftFirewallLog = "Microsoft-FirewallLog"; - public const string MicrosoftHealthStateChange = "Microsoft-HealthStateChange"; - public const string MicrosoftHeartbeat = "Microsoft-Heartbeat"; - public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; - public const string MicrosoftOperationLog = "Microsoft-OperationLog"; - public const string MicrosoftPerf = "Microsoft-Perf"; - public const string MicrosoftProcessInvestigator = "Microsoft-ProcessInvestigator"; - public const string MicrosoftProtectionStatus = "Microsoft-ProtectionStatus"; - public const string MicrosoftRomeDetectionEvent = "Microsoft-RomeDetectionEvent"; - public const string MicrosoftSecurityBaseline = "Microsoft-SecurityBaseline"; - public const string MicrosoftSecurityBaselineSummary = "Microsoft-SecurityBaselineSummary"; - public const string MicrosoftSecurityEvent = "Microsoft-SecurityEvent"; - public const string MicrosoftSyslog = "Microsoft-Syslog"; - public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs deleted file mode 100644 index 8dd2e7a0aba31..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownExtensionDataSourceStreams.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Code generated 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 KnownExtensionDataSourceStreams. - /// - public static class KnownExtensionDataSourceStreams - { - public const string MicrosoftAntiMalwareStatus = "Microsoft-AntiMalwareStatus"; - public const string MicrosoftAuditd = "Microsoft-Auditd"; - public const string MicrosoftCISCOASA = "Microsoft-CISCOASA"; - public const string MicrosoftCommonSecurityLog = "Microsoft-CommonSecurityLog"; - public const string MicrosoftComputerGroup = "Microsoft-ComputerGroup"; - public const string MicrosoftEvent = "Microsoft-Event"; - public const string MicrosoftFirewallLog = "Microsoft-FirewallLog"; - public const string MicrosoftHealthStateChange = "Microsoft-HealthStateChange"; - public const string MicrosoftHeartbeat = "Microsoft-Heartbeat"; - public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; - public const string MicrosoftOperationLog = "Microsoft-OperationLog"; - public const string MicrosoftPerf = "Microsoft-Perf"; - public const string MicrosoftProcessInvestigator = "Microsoft-ProcessInvestigator"; - public const string MicrosoftProtectionStatus = "Microsoft-ProtectionStatus"; - public const string MicrosoftRomeDetectionEvent = "Microsoft-RomeDetectionEvent"; - public const string MicrosoftSecurityBaseline = "Microsoft-SecurityBaseline"; - public const string MicrosoftSecurityBaselineSummary = "Microsoft-SecurityBaselineSummary"; - public const string MicrosoftSecurityEvent = "Microsoft-SecurityEvent"; - public const string MicrosoftSyslog = "Microsoft-Syslog"; - public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs deleted file mode 100644 index c9592a0edf985..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceScheduledTransferPeriod.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// Code generated 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 KnownPerfCounterDataSourceScheduledTransferPeriod. - /// - public static class KnownPerfCounterDataSourceScheduledTransferPeriod - { - public const string PT1M = "PT1M"; - public const string PT5M = "PT5M"; - public const string PT15M = "PT15M"; - public const string PT30M = "PT30M"; - public const string PT60M = "PT60M"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs deleted file mode 100644 index 7a799f50bc2b8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownPerfCounterDataSourceStreams.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// Code generated 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 KnownPerfCounterDataSourceStreams. - /// - public static class KnownPerfCounterDataSourceStreams - { - public const string MicrosoftPerf = "Microsoft-Perf"; - public const string MicrosoftInsightsMetrics = "Microsoft-InsightsMetrics"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs deleted file mode 100644 index 09faafba7b2c5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceFacilityNames.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Code generated 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 KnownSyslogDataSourceFacilityNames. - /// - public static class KnownSyslogDataSourceFacilityNames - { - public const string Auth = "auth"; - public const string Authpriv = "authpriv"; - public const string Cron = "cron"; - public const string Daemon = "daemon"; - public const string Kern = "kern"; - public const string Lpr = "lpr"; - public const string Mail = "mail"; - public const string Mark = "mark"; - public const string News = "news"; - public const string Syslog = "syslog"; - public const string User = "user"; - public const string UUCP = "UUCP"; - public const string Local0 = "local0"; - public const string Local1 = "local1"; - public const string Local2 = "local2"; - public const string Local3 = "local3"; - public const string Local4 = "local4"; - public const string Local5 = "local5"; - public const string Local6 = "local6"; - public const string Local7 = "local7"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs deleted file mode 100644 index a88501ccb697c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceLogLevels.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Code generated 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 KnownSyslogDataSourceLogLevels. - /// - public static class KnownSyslogDataSourceLogLevels - { - public const string Debug = "Debug"; - public const string Info = "Info"; - public const string Notice = "Notice"; - public const string Warning = "Warning"; - public const string Error = "Error"; - public const string Critical = "Critical"; - public const string Alert = "Alert"; - public const string Emergency = "Emergency"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs deleted file mode 100644 index f55635df2a937..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownSyslogDataSourceStreams.cs +++ /dev/null @@ -1,17 +0,0 @@ -// -// Code generated 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 KnownSyslogDataSourceStreams. - /// - public static class KnownSyslogDataSourceStreams - { - public const string MicrosoftSyslog = "Microsoft-Syslog"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs deleted file mode 100644 index 53d938db10e39..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceScheduledTransferPeriod.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Code generated 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 - /// KnownWindowsEventLogDataSourceScheduledTransferPeriod. - /// - public static class KnownWindowsEventLogDataSourceScheduledTransferPeriod - { - public const string PT1M = "PT1M"; - public const string PT5M = "PT5M"; - public const string PT15M = "PT15M"; - public const string PT30M = "PT30M"; - public const string PT60M = "PT60M"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs deleted file mode 100644 index f4615e9028786..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/KnownWindowsEventLogDataSourceStreams.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// Code generated 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 KnownWindowsEventLogDataSourceStreams. - /// - public static class KnownWindowsEventLogDataSourceStreams - { - public const string MicrosoftWindowsEvent = "Microsoft-WindowsEvent"; - public const string MicrosoftEvent = "Microsoft-Event"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs index fc6aeb8b157a3..8d2e2410d2a13 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs @@ -73,21 +73,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs index bd046924a9959..6d519443ccec2 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs @@ -138,21 +138,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "SamplingFrequencyInSeconds", 1); } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs index d1078c00a6818..f3106d2c8e3df 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs @@ -102,21 +102,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs index ee17d7f33d2a8..61f6f218370f7 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs @@ -112,21 +112,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Name != null) - { - if (Name.Length > 32) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 32); - } - if (Name.Length < 0) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 0); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[-\\w\\._\\(\\)]+$"); - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs index 49023273bd962..aedbcd71c6ab5 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs @@ -204,6 +204,12 @@ public partial class MonitorManagementClient : ServiceClient public virtual IDataCollectionRules DataCollectionRules { get; private set; } + /// + /// Gets the IDataCollectionRuleAssociations. + /// + public virtual IDataCollectionRuleAssociations DataCollectionRuleAssociations { get; private set; } + + /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -472,6 +478,7 @@ private void Initialize() PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); DataCollectionRules = new DataCollectionRules(this); + DataCollectionRuleAssociations = new DataCollectionRuleAssociations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; From 09d26d932f6a34c08583618652627f6695e751de Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Wed, 7 Oct 2020 22:43:35 -0500 Subject: [PATCH 4/7] Adding DCRA & Testing --- .../DataCollectionRuleAssociations.cs | 12 +- ...ataCollectionRuleAssociationsExtensions.cs | 8 +- .../src/Generated/DataCollectionRules.cs | 12 +- .../DataCollectionRulesExtensions.cs | 8 +- .../IDataCollectionRuleAssociations.cs | 4 +- .../src/Generated/IDataCollectionRules.cs | 4 +- .../Generated/Models/DataCollectionRule.cs | 119 ---- .../Models/DataCollectionRuleAssociation.cs | 85 --- ...lectionRuleAssociationProxyOnlyResource.cs | 26 +- ...eAssociationProxyOnlyResourceListResult.cs | 84 --- .../Models/DataCollectionRuleResource.cs | 44 +- .../DataCollectionRuleResourceListResult.cs | 84 --- .../BasicTests/DataCollectionRulesTests.cs | 550 ++++++++++++++++++ 13 files changed, 581 insertions(+), 459 deletions(-) delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/BasicTests/DataCollectionRulesTests.cs diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs index 7b50e203f6e62..47e1bf2dd536a 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs @@ -76,7 +76,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceUri == null) { @@ -181,7 +181,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -190,7 +190,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -239,7 +239,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -385,7 +385,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -394,7 +394,7 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs index f54df002f9d04..cb5e017e2e08e 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs @@ -25,7 +25,7 @@ public static partial class DataCollectionRuleAssociationsExtensions /// /// The identifier of the resource. /// - public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByResource(this IDataCollectionRuleAssociations operations, string resourceUri) + public static Page ListByResource(this IDataCollectionRuleAssociations operations, string resourceUri) { return operations.ListByResourceAsync(resourceUri).GetAwaiter().GetResult(); } @@ -42,7 +42,7 @@ public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByRes /// /// The cancellation token. /// - public static async Task ListByResourceAsync(this IDataCollectionRuleAssociations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceAsync(this IDataCollectionRuleAssociations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) { @@ -62,7 +62,7 @@ public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByRes /// /// The name of the data collection rule. The name is case insensitive. /// - public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByRule(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName) + public static Page ListByRule(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName) { return operations.ListByRuleAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); } @@ -82,7 +82,7 @@ public static DataCollectionRuleAssociationProxyOnlyResourceListResult ListByRul /// /// The cancellation token. /// - public static async Task ListByRuleAsync(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByRuleAsync(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByRuleWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs index 793620cb36d6b..10fdc320d535d 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -76,7 +76,7 @@ public DataCollectionRules(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -201,7 +201,7 @@ public DataCollectionRules(MonitorManagementClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -210,7 +210,7 @@ public DataCollectionRules(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -253,7 +253,7 @@ public DataCollectionRules(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -357,7 +357,7 @@ public DataCollectionRules(MonitorManagementClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + var _result = new HttpOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response @@ -366,7 +366,7 @@ public DataCollectionRules(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs index d20e2b8e68b75..1c443c8cbf1aa 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs @@ -25,7 +25,7 @@ public static partial class DataCollectionRulesExtensions /// /// The name of the resource group. The name is case insensitive. /// - public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) + public static Page ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) { return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } @@ -42,7 +42,7 @@ public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDat /// /// The cancellation token. /// - public static async Task ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -56,7 +56,7 @@ public static DataCollectionRuleResourceListResult ListByResourceGroup(this IDat /// /// The operations group for this extension method. /// - public static DataCollectionRuleResourceListResult ListBySubscription(this IDataCollectionRules operations) + public static Page ListBySubscription(this IDataCollectionRules operations) { return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); } @@ -70,7 +70,7 @@ public static DataCollectionRuleResourceListResult ListBySubscription(this IData /// /// The cancellation token. /// - public static async Task ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs index 4175e4c4490d3..cdceddf6a90a9 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs @@ -41,7 +41,7 @@ public partial interface IDataCollectionRuleAssociations /// /// Thrown when a required parameter is null /// - Task> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists associations for the specified data collection rule. /// @@ -66,7 +66,7 @@ public partial interface IDataCollectionRuleAssociations /// /// Thrown when a required parameter is null /// - Task> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns the specified association. /// diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs index d9b5c0af5cefb..1002215a1d476 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs @@ -41,7 +41,7 @@ public partial interface IDataCollectionRules /// /// Thrown when a required parameter is null /// - Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all data collection rules in the specified subscription. /// @@ -60,7 +60,7 @@ public partial interface IDataCollectionRules /// /// Thrown when a required parameter is null /// - Task> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns the specified data collection rule. /// diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs deleted file mode 100644 index ebffbf57361e7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRule.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Code generated 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; - - /// - /// Definition of what monitoring data to collect and where that data - /// should be sent. - /// - public partial class DataCollectionRule - { - /// - /// Initializes a new instance of the DataCollectionRule class. - /// - public DataCollectionRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataCollectionRule class. - /// - /// The specification of - /// destinations. - /// The specification of data flows. - /// Description of the data collection - /// rule. - /// The specification of data sources. - /// This property is optional and can be omitted if the rule is meant - /// to be used via direct calls to the provisioned endpoint. - /// The resource provisioning state. - /// Possible values include: 'Creating', 'Updating', 'Deleting', - /// 'Succeeded', 'Failed' - public DataCollectionRule(DataCollectionRuleDestinations destinations, IList dataFlows, string description = default(string), DataCollectionRuleDataSources dataSources = default(DataCollectionRuleDataSources), string provisioningState = default(string)) - { - Description = description; - DataSources = dataSources; - Destinations = destinations; - DataFlows = dataFlows; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets description of the data collection rule. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the specification of data sources. - /// This property is optional and can be omitted if the rule is meant - /// to be used via direct calls to the provisioned endpoint. - /// - [JsonProperty(PropertyName = "dataSources")] - public DataCollectionRuleDataSources DataSources { get; set; } - - /// - /// Gets or sets the specification of destinations. - /// - [JsonProperty(PropertyName = "destinations")] - public DataCollectionRuleDestinations Destinations { get; set; } - - /// - /// Gets or sets the specification of data flows. - /// - [JsonProperty(PropertyName = "dataFlows")] - public IList DataFlows { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Destinations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); - } - if (DataFlows == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataFlows"); - } - if (DataFlows != null) - { - foreach (var element in DataFlows) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs deleted file mode 100644 index 0775f9fb50e1a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociation.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Code generated 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; - - /// - /// Definition of association of a data collection rule with a monitored - /// Azure resource. - /// - public partial class DataCollectionRuleAssociation - { - /// - /// Initializes a new instance of the DataCollectionRuleAssociation - /// class. - /// - public DataCollectionRuleAssociation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataCollectionRuleAssociation - /// class. - /// - /// The resource ID of the data - /// collection rule that is to be associated. - /// Description of the association. - /// The resource provisioning state. - /// Possible values include: 'Creating', 'Updating', 'Deleting', - /// 'Succeeded', 'Failed' - public DataCollectionRuleAssociation(string dataCollectionRuleId, string description = default(string), string provisioningState = default(string)) - { - Description = description; - DataCollectionRuleId = dataCollectionRuleId; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets description of the association. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the resource ID of the data collection rule that is to - /// be associated. - /// - [JsonProperty(PropertyName = "dataCollectionRuleId")] - public string DataCollectionRuleId { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DataCollectionRuleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataCollectionRuleId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs index b7f96e14d17bd..96789654534da 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs @@ -7,15 +7,13 @@ namespace Microsoft.Azure.Management.Monitor.Models { using Microsoft.Rest; - using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Linq; /// /// Definition of generic ARM proxy resource. /// [Rest.Serialization.JsonTransformation] - public partial class DataCollectionRuleAssociationProxyOnlyResource + public partial class DataCollectionRuleAssociationProxyOnlyResource : ProxyOnlyResource { /// /// Initializes a new instance of the @@ -41,13 +39,11 @@ public DataCollectionRuleAssociationProxyOnlyResource() /// The type of the resource. /// Resource entity tag (ETag). public DataCollectionRuleAssociationProxyOnlyResource(string dataCollectionRuleId, string description = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) { Description = description; DataCollectionRuleId = dataCollectionRuleId; ProvisioningState = provisioningState; - Id = id; - Name = name; - Type = type; Etag = etag; CustomInit(); } @@ -77,24 +73,6 @@ public DataCollectionRuleAssociationProxyOnlyResource() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } - /// - /// Gets fully qualified ID of the resource. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the name of the resource. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the type of the resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - /// /// Gets resource entity tag (ETag). /// diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs deleted file mode 100644 index 53a80a1e277c3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResourceListResult.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// Code generated 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; - - /// - /// A pageable list of resources. - /// - public partial class DataCollectionRuleAssociationProxyOnlyResourceListResult - { - /// - /// Initializes a new instance of the - /// DataCollectionRuleAssociationProxyOnlyResourceListResult class. - /// - public DataCollectionRuleAssociationProxyOnlyResourceListResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DataCollectionRuleAssociationProxyOnlyResourceListResult class. - /// - /// A list of resources. - /// The URL to use for getting the next set of - /// results. - public DataCollectionRuleAssociationProxyOnlyResourceListResult(IList value, string nextLink = default(string)) - { - Value = value; - NextLink = nextLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a list of resources. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - /// - /// Gets or sets the URL to use for getting the next set of results. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (Value != null) - { - foreach (var element in Value) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs index 1cc8edd0e670e..4d31b6a37da8b 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs @@ -7,17 +7,14 @@ 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; /// /// Definition of ARM tracked top level resource. /// [Rest.Serialization.JsonTransformation] - public partial class DataCollectionRuleResource + public partial class DataCollectionRuleResource : Resource { /// /// Initializes a new instance of the DataCollectionRuleResource class. @@ -49,6 +46,7 @@ public DataCollectionRuleResource() /// The type of the resource. /// Resource entity tag (ETag). public DataCollectionRuleResource(DataCollectionRuleDestinations destinations, IList dataFlows, string location, string description = default(string), DataCollectionRuleDataSources dataSources = default(DataCollectionRuleDataSources), string provisioningState = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(location, id, name, type, tags) { Description = description; DataSources = dataSources; @@ -56,10 +54,6 @@ public DataCollectionRuleResource() DataFlows = dataFlows; ProvisioningState = provisioningState; Location = location; - Tags = tags; - Id = id; - Name = name; - Type = type; Etag = etag; CustomInit(); } @@ -102,36 +96,6 @@ public DataCollectionRuleResource() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } - /// - /// Gets or sets the geo-location where the resource lives. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets resource tags. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets fully qualified ID of the resource. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the name of the resource. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the type of the resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - /// /// Gets resource entity tag (ETag). /// @@ -144,8 +108,10 @@ public DataCollectionRuleResource() /// /// Thrown if validation fails /// - public virtual void Validate() + public override void Validate() { + base.Validate(); + if (Destinations == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs deleted file mode 100644 index 8802253e28253..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResourceListResult.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// Code generated 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; - - /// - /// A pageable list of resources. - /// - public partial class DataCollectionRuleResourceListResult - { - /// - /// Initializes a new instance of the - /// DataCollectionRuleResourceListResult class. - /// - public DataCollectionRuleResourceListResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DataCollectionRuleResourceListResult class. - /// - /// A list of resources. - /// The URL to use for getting the next set of - /// results. - public DataCollectionRuleResourceListResult(IList value, string nextLink = default(string)) - { - Value = value; - NextLink = nextLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a list of resources. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - /// - /// Gets or sets the URL to use for getting the next set of results. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (Value != null) - { - foreach (var element in Value) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/BasicTests/DataCollectionRulesTests.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/BasicTests/DataCollectionRulesTests.cs new file mode 100644 index 0000000000000..9f64b8588105e --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/BasicTests/DataCollectionRulesTests.cs @@ -0,0 +1,550 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Azure.Management.Monitor; +using Microsoft.Azure.Management.Monitor.Models; +using Microsoft.Rest; +using Microsoft.Rest.Azure; +using Monitor.Tests.Helpers; + +using Newtonsoft.Json; + +using Xunit; + +namespace Monitor.Tests.BasicTests +{ + public class DataCollectionRulesTests : TestBase + { + #region DCR Tests + [Fact] + [Trait("Category", "Mock")] + public void CreateDataCollectionRuleTest() + { + DataCollectionRuleResource expectedResult = new DataCollectionRuleResource( + new DataCollectionRuleDestinations(), + new List(), + "eastus", "Second DCR", + new DataCollectionRuleDataSources()); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(expectedResult, insightsClient.SerializationSettings); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(serializedObject) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var result = insightsClient.DataCollectionRules.Create("rg-amcs-test", "dcrCreateDataCollectionRuleTest", new DataCollectionRuleResource( + destinations: new DataCollectionRuleDestinations(), + dataFlows: new List(), + location: "eastus", + description: "Second DCR", + dataSources: new DataCollectionRuleDataSources(), + provisioningState: null, + tags: null, + id: null, + name: null, + type: null, + etag: null + )); + + AreEqual(expectedResult, result); + } + + [Fact] + [Trait("Category", "Mock")] + public async Task DeleteDataCollectionRuleTestAsync() + { + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK); + + var handler = new RecordedDelegatingHandler(expectedResponse); + var monitorManagementClient = GetMonitorManagementClient(handler); + + var response = await monitorManagementClient.DataCollectionRules.DeleteWithHttpMessagesAsync("rg-amcs-test", "dcrDeleteDataCollectionRuleTest"); + + Assert.Equal(HttpStatusCode.OK, response.Response.StatusCode); + } + + [Fact] + [Trait("Category", "Mock")] + public void GetDataCollectionRuleTest() + { + var expectedResult = new DataCollectionRuleResource( + new DataCollectionRuleDestinations(), + new List(), + "eastus", "Second DCR", + new DataCollectionRuleDataSources()); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(expectedResult, insightsClient.SerializationSettings); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(serializedObject) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var result = insightsClient.DataCollectionRules.Get("rg-amcs-test", "dcrGetDataCollectionRuleTest"); + + AreEqual(expectedResult, result); + } + + [Fact] + [Trait("Category", "Mock")] + public void ListDataCollectionRulesByResourceGroupTest() + { + List expectedResult = new List + { + new DataCollectionRuleResource( + new DataCollectionRuleDestinations + { + AzureMonitorMetrics = new DestinationsSpecAzureMonitorMetrics("defaultAmm") + }, + new List(), + "eastus", "First DCR", + new DataCollectionRuleDataSources()), + new DataCollectionRuleResource(new DataCollectionRuleDestinations(), new List(), "eastus", "Second DCR", new DataCollectionRuleDataSources()), + new DataCollectionRuleResource(new DataCollectionRuleDestinations(), new List(), "eastus", "Third DCR", new DataCollectionRuleDataSources()) + }; + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(expectedResult, insightsClient.SerializationSettings); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(string.Concat("{ \"value\":", serializedObject, "}")) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var actualDcrs = insightsClient.DataCollectionRules.ListByResourceGroup(resourceGroupName: "rg-amcs-test"); + + AreEqual(expectedResult, actualDcrs.ToList()); + } + + [Fact] + [Trait("Category", "Mock")] + public void ListDataCollectionRulesBySusbscriptionTest() + { + List expectedResult = new List + { + new DataCollectionRuleResource( + new DataCollectionRuleDestinations + { + LogAnalytics = new List + { + new LogAnalyticsDestination("/subscription/aaa/", "la-testing") + } + }, + new List(), + "eastus", "First DCR", + new DataCollectionRuleDataSources()), + new DataCollectionRuleResource(new DataCollectionRuleDestinations(), new List(), "eastus", "Second DCR", new DataCollectionRuleDataSources()), + }; + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(expectedResult, insightsClient.SerializationSettings); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(string.Concat("{ \"value\":", serializedObject, "}")) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var actualDcrs = insightsClient.DataCollectionRules.ListBySubscription(); + + AreEqual(expectedResult, actualDcrs.ToList()); + } + + [Fact] + [Trait("Category", "Mock")] + public void UpdateDataCollectionRuleTest() + { + var expectedResult = new ResourceForUpdate(new Dictionary + { + { "tag1", "value1" }, + { "tag2", "value2" } + }); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(expectedResult, insightsClient.SerializationSettings); + + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(serializedObject) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + ActionGroupPatchBody bodyParameter = new ActionGroupPatchBody + { + Enabled = true, + Tags = null + }; + + var result = insightsClient.DataCollectionRules.Update("rg-amcs-test", "dcrUpdateDataCollectionRuleTest", expectedResult); + Utilities.AreEqual(expectedResult.Tags, result.Tags); + } + #endregion + + #region DCR AreEqual Helpers + private static void AreEqual(DataCollectionRuleResource exp, DataCollectionRuleResource act) + { + if (exp != null) + { + Assert.Equal(exp.Id, act.Id); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Description, act.Description); + Assert.Equal(exp.Etag, act.Etag); + Assert.Equal(exp.Location, act.Location); + Assert.Equal(exp.ProvisioningState, act.ProvisioningState); + Assert.Equal(exp.Type, act.Type); + Utilities.AreEqual(exp.Tags, act.Tags); + + AreEqual(exp.DataFlows, act.DataFlows); + AreEqual(exp.DataSources, act.DataSources); + AreEqual(exp.Destinations, act.Destinations); + } + } + + private static void AreEqual(IList exp, IList act) + { + if (exp != null) + { + for (int i = 0; i < exp.Count; i++) + { + AreEqual(exp[i], act[i]); + } + } + } + + private static void AreEqual(List exp, List act) + { + if (exp != null) + { + for (int i = 0; i < exp.Count; i++) + { + AreEqual(exp[i], act[i]); + } + } + } + + private static void AreEqual(DataCollectionRuleDataSources exp, DataCollectionRuleDataSources act) + { + if (exp != null) + { + if (exp.PerformanceCounters != null) + { + for (int i = 0; i < exp.PerformanceCounters.Count; i++) + { + AreEqual(exp.PerformanceCounters[i], act.PerformanceCounters[i]); + } + } + + if (exp.WindowsEventLogs != null) + { + for (int i = 0; i < exp.WindowsEventLogs.Count; i++) + { + AreEqual(exp.WindowsEventLogs[i], act.WindowsEventLogs[i]); + } + } + + if (exp.Syslog != null) + { + for (int i = 0; i < exp.Syslog.Count; i++) + { + AreEqual(exp.Syslog[i], act.Syslog[i]); + } + } + + if (exp.Extensions != null) + { + for (int i = 0; i < exp.Extensions.Count; i++) + { + AreEqual(exp.Extensions[i], act.Extensions[i]); + } + } + } + } + + private static void AreEqual(DataCollectionRuleDestinations exp, DataCollectionRuleDestinations act) + { + if (exp != null) + { + if (exp.AzureMonitorMetrics != null) + { + Assert.Equal(exp.AzureMonitorMetrics.Name, act.AzureMonitorMetrics.Name); + } + + if (exp.LogAnalytics != null) + { + for (int i = 0; i < exp.LogAnalytics.Count; i++) + { + AreEqual(exp.LogAnalytics[i], act.LogAnalytics[i]); + } + } + } + } + + private static void AreEqual(DataFlow exp, DataFlow act) + { + if (exp != null) + { + Assert.Equal(exp.Destinations.ToJson(), act.Destinations.ToJson()); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(PerfCounterDataSource exp, PerfCounterDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.CounterSpecifiers.ToJson(), act.CounterSpecifiers.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.SamplingFrequencyInSeconds, act.SamplingFrequencyInSeconds); + Assert.Equal(exp.ScheduledTransferPeriod, act.ScheduledTransferPeriod); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(WindowsEventLogDataSource exp, WindowsEventLogDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.ScheduledTransferPeriod, act.ScheduledTransferPeriod); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + Assert.Equal(exp.XPathQueries.ToJson(), act.XPathQueries.ToJson()); + } + } + + private static void AreEqual(SyslogDataSource exp, SyslogDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.FacilityNames.ToJson(), act.FacilityNames.ToJson()); + Assert.Equal(exp.LogLevels.ToJson(), act.LogLevels.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(ExtensionDataSource exp, ExtensionDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.ExtensionName, act.ExtensionName); + Assert.Equal(exp.ExtensionSettings.ToJson(), act.ExtensionSettings.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(LogAnalyticsDestination exp, LogAnalyticsDestination act) + { + if (exp != null) + { + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.WorkspaceResourceId, act.WorkspaceResourceId); + } + } + #endregion + + #region DCRA Tests + [Fact] + [Trait("Category", "Mock")] + public void CreateDataCollectionRuleAssociationTest() + { + var expectedResult = GetOneDcra("CreateTest"); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(SerializeDcra(expectedResult, insightsClient.SerializationSettings)) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var result = insightsClient.DataCollectionRuleAssociations.Create( + resourceUri: "/subscriptions/xxxxxxx-xxxx-xxxx/resourceGroups/rgGroup/providers/Microsoft.Compute/virtualMachines/vm-Test", + associationName: "dcrBcdrTestAssoc", + body: expectedResult); + + AreEqual(expectedResult, result); + } + + [Fact] + [Trait("Category", "Mock")] + public async Task DeleteDataCollectionRuleAssociationTestAsync() + { + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK); + + var handler = new RecordedDelegatingHandler(expectedResponse); + var monitorManagementClient = GetMonitorManagementClient(handler); + + var response = await monitorManagementClient.DataCollectionRuleAssociations.DeleteWithHttpMessagesAsync( + resourceUri: "/subscriptions/xxxxxxx-xxxx-xxxx/resourceGroups/rgGroup/providers/Microsoft.Compute/virtualMachines/vm-Test", + associationName: "dcrBcdrTestAssoc"); + + Assert.Equal(HttpStatusCode.OK, response.Response.StatusCode); + } + + [Fact] + [Trait("Category", "Mock")] + public void GetDataCollectionRuleAssociationTest() + { + var expectedResult = GetOneDcra("GetTest"); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(SerializeDcra(expectedResult, insightsClient.SerializationSettings)) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var result = insightsClient.DataCollectionRuleAssociations.Get("rg-amcs-test", "dcrAssoc"); + + AreEqual(expectedResult, result); + } + + [Fact] + [Trait("Category", "Mock")] + public void ListDataCollectionRulesAssociationByResourceTest() + { + var expectedResult = GetListDcra(); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(SerializeDcraList(expectedResult, insightsClient.SerializationSettings)) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var actualDcrs = insightsClient.DataCollectionRuleAssociations.ListByResource( + resourceUri: "/subscriptions/xxxxxxx-xxxx-xxxx/resourceGroups/rgGroup/providers/Microsoft.Compute/virtualMachines/vm-Test"); + + AreEqual(expectedResult, actualDcrs.ToList()); + } + + [Fact] + [Trait("Category", "Mock")] + public void ListDataCollectionRulesAssociationByRuleTest() + { + var expectedResult = GetListDcra(); + + var handler = new RecordedDelegatingHandler(); + var insightsClient = GetMonitorManagementClient(handler); + var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(SerializeDcraList(expectedResult, insightsClient.SerializationSettings)) + }; + + handler = new RecordedDelegatingHandler(expectedResponse); + insightsClient = GetMonitorManagementClient(handler); + + var actualDcrs = insightsClient.DataCollectionRuleAssociations.ListByRule( + "rg-amcs-test", "dcrGetDataCollectionRuleTest"); + + AreEqual(expectedResult, actualDcrs.ToList()); + } + #endregion + + #region DCRA Helpers + private DataCollectionRuleAssociationProxyOnlyResource GetOneDcra(string id) + { + return new DataCollectionRuleAssociationProxyOnlyResource( + dataCollectionRuleId: "/subscriptions/xxxxxxx-xxxx-xxxx/resourceGroups/rgGroup/providers/Microsoft.Insights/dataCollectionRules/dcrName", + description: "Associate VM to DCR", + provisioningState: null, + id: id, + name: "dcrBcdrTestAssoc", + type: "Microsoft.Insights/dataCollectionRuleAssociations", + etag: null + ); + } + + private List GetListDcra() + { + return new List + { + GetOneDcra("First DCRA"), + GetOneDcra("Second DCRA"), + GetOneDcra("Third DCRA") + }; + } + + private string SerializeDcra(DataCollectionRuleAssociationProxyOnlyResource drca, JsonSerializerSettings jsonSerializerSettings) + { + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(drca, jsonSerializerSettings); + var currPos = serializedObject.IndexOf("\"properties\":", 0); + serializedObject = serializedObject.Insert(currPos, "\"name\":\"" + drca.Name + "\",\r\n\"type\":\"" + drca.Type + "\",\r\n\"id\":\"" + drca.Id + "\",\r\n"); + + return serializedObject; + } + + private string SerializeDcraList(List drcaList, JsonSerializerSettings jsonSerializerSettings) + { + var serializedObject = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(drcaList, jsonSerializerSettings); + + var startIndex = 0; + foreach (var dcra in drcaList) + { + var currPos = serializedObject.IndexOf("\"properties\":", startIndex); + serializedObject = serializedObject.Insert(currPos, "\"name\":\"" + dcra.Name + "\",\r\n\"type\":\"" + dcra.Type + "\",\r\n\"id\":\"" + dcra.Id + "\",\r\n"); + startIndex = serializedObject.IndexOf("\"properties\":", startIndex) + 1; + } + + return string.Concat("{ \"value\":", serializedObject, "}"); + } + + private static void AreEqual(DataCollectionRuleAssociationProxyOnlyResource exp, DataCollectionRuleAssociationProxyOnlyResource act) + { + if (exp != null) + { + Assert.Equal(exp.DataCollectionRuleId, act.DataCollectionRuleId); + Assert.Equal(exp.Description, act.Description); + Assert.Equal(exp.Etag, act.Etag); + Assert.Equal(exp.Id, act.Id); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.ProvisioningState, act.ProvisioningState); + Assert.Equal(exp.Type, act.Type); + } + } + + private static void AreEqual(List exp, List act) + { + if (exp != null) + { + for (int i = 0; i < exp.Count; i++) + { + AreEqual(exp[i], act[i]); + } + } + } + #endregion + } +} \ No newline at end of file From 203c5d5946ff54493e97521a109b8d01dedc66dd Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Thu, 8 Oct 2020 10:39:09 -0500 Subject: [PATCH 5/7] Update on csproj & RP.props file --- .../Microsoft.Azure.Management.Monitor/AzSdk.RP.props | 2 +- .../src/Microsoft.Azure.Management.Monitor.csproj | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/AzSdk.RP.props b/sdk/monitor/Microsoft.Azure.Management.Monitor/AzSdk.RP.props index 3430354123765..93e5557838b22 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/AzSdk.RP.props +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/AzSdk.RP.props @@ -1,7 +1,7 @@ - Insights_2018-03-01;Insights_2018-11-27-preview;insights_2019-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_2017-12-01-preview;insights_2018-04-16;insights_2019-10-17-preview; + Insights_2018-03-01;Insights_2018-11-27-preview;insights_2019-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_2017-12-01-preview;insights_2018-04-16;insights_2019-10-17-preview;insights_2019-11-01-preview; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Microsoft.Azure.Management.Monitor.csproj b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Microsoft.Azure.Management.Monitor.csproj index a22a86799e413..4fef15f51bd0f 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Microsoft.Azure.Management.Monitor.csproj +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Microsoft.Azure.Management.Monitor.csproj @@ -6,11 +6,12 @@ Microsoft Azure Monitor Library Microsoft.Azure.Management.Monitor - 0.25.2-preview + 0.25.3-preview Microsoft.Azure.Management.Monitor - Management.Monitor;Management.Monitoring;metrics;alerts;autoscale;activityLogs;events;operations;logs;privatelinkscope + Management.Monitor;Management.Monitoring;metrics;alerts;autoscale;activityLogs;events;operations;logs;privatelinkscope;datacollectionrules - - Adding API **2018-03-01/metricAlert_API**. Support SkipMetricValidation property. + - Adding API **2019-11-01-preview/dataCollectionRules_API** + - Adding API **2019-11-01-preview/dataCollectionRuleAssociations_API.json** From 2c948c5814e141cf63386f23dbb8b3bff34aab4b Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Thu, 8 Oct 2020 10:59:50 -0500 Subject: [PATCH 6/7] Update monitor_resource-manager.txt & SdkInfo changes --- eng/mgmt/mgmtmetadata/monitor_resource-manager.txt | 6 +++--- .../src/Generated/SdkInfo_MonitorClient.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eng/mgmt/mgmtmetadata/monitor_resource-manager.txt b/eng/mgmt/mgmtmetadata/monitor_resource-manager.txt index f9d615e33a513..9ca1d1db375bc 100644 --- a/eng/mgmt/mgmtmetadata/monitor_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/monitor_resource-manager.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2020-03 --csharp-sdks-folder=C:\users\odhutzle\Documents\repositories\azure-sdk-for-net\sdk -2020-09-07 13:00:39 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\Repos\azure-sdk-for-net\sdk +2020-10-08 15:50:00 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 35d24315a39e1519597ec5d5b55f73921f12b57a +Commit: 27cc07ddd294d98e05cb301e07a72378df9f87e8 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs index e3c5a4b62921e..25d90d1590b2e 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs @@ -19,6 +19,8 @@ public static IEnumerable> ApiInfo_MonitorClient { return new Tuple[] { + new Tuple("Insights", "DataCollectionRules", "2019-11-01-preview"), + new Tuple("Insights", "DataCollectionRuleAssociations", "2019-11-01-preview"), new Tuple("Insights", "MetricAlerts", "2018-03-01"), new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), new Tuple("Insights", "PrivateEndpointConnections", "2019-10-17-preview"), @@ -51,10 +53,10 @@ public static IEnumerable> ApiInfo_MonitorClient // BEGIN: Code Generation Metadata Section public static readonly String AutoRestVersion = "v2"; public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2020-03 --csharp-sdks-folder=C:\\users\\odhutzle\\Documents\\repositories\\azure-sdk-for-net\\sdk"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\sdk"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "35d24315a39e1519597ec5d5b55f73921f12b57a"; + public static readonly String GithubCommidId = "27cc07ddd294d98e05cb301e07a72378df9f87e8"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section From 31d102dc9f87e6eda596b17ca12c7499c20466b2 Mon Sep 17 00:00:00 2001 From: Jorge Herrera Date: Mon, 12 Oct 2020 17:29:50 -0500 Subject: [PATCH 7/7] Fix Creadential in DCR & DCRA service operation API; Add Recorded Session Test --- .../DataCollectionRuleAssociations.cs | 30 + .../src/Generated/DataCollectionRules.cs | 36 ++ .../Scenarios/DataCollectionRulesTests.cs | 380 +++++++++++ .../CreateDcrTest.json | 206 ++++++ .../DcrAssociationTest.json | 470 ++++++++++++++ .../DeleteDcrTest.json | 260 ++++++++ .../ListDcrBySubscriptionTest.json | 602 ++++++++++++++++++ .../UpdateDcrTest.json | 278 ++++++++ 8 files changed, 2262 insertions(+) create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/Scenarios/DataCollectionRulesTests.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/CreateDcrTest.json create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DcrAssociationTest.json create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DeleteDcrTest.json create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/ListDcrBySubscriptionTest.json create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/UpdateDcrTest.json diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs index 47e1bf2dd536a..4fae9f9b9192a 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs @@ -137,6 +137,12 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) // 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) { @@ -341,6 +347,12 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) // 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) { @@ -525,6 +537,12 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) // 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) { @@ -723,6 +741,12 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) _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) { @@ -922,6 +946,12 @@ public DataCollectionRuleAssociations(MonitorManagementClient client) // 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) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs index 10fdc320d535d..8b5de5f0a032a 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -157,6 +157,12 @@ public DataCollectionRules(MonitorManagementClient client) // 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) { @@ -313,6 +319,12 @@ public DataCollectionRules(MonitorManagementClient client) // 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) { @@ -517,6 +529,12 @@ public DataCollectionRules(MonitorManagementClient client) // 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) { @@ -735,6 +753,12 @@ public DataCollectionRules(MonitorManagementClient client) _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) { @@ -967,6 +991,12 @@ public DataCollectionRules(MonitorManagementClient client) _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) { @@ -1168,6 +1198,12 @@ public DataCollectionRules(MonitorManagementClient client) // 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) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/Scenarios/DataCollectionRulesTests.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/Scenarios/DataCollectionRulesTests.cs new file mode 100644 index 0000000000000..e3a5ecd3037e8 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/Scenarios/DataCollectionRulesTests.cs @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Net; +using Monitor.Tests.Helpers; +using Microsoft.Azure.Management.Monitor; +using Microsoft.Azure.Management.Monitor.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Xunit; + +namespace Monitor.Tests.Scenarios +{ + public class DataCollectionRulesTests : TestBase + { + private const string ResourceGroupName = "netSdkTestRecord"; + private const string vmResourceUri = "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe"; + + private RecordedDelegatingHandler handler; + + public DataCollectionRulesTests() + : base() + { + handler = new RecordedDelegatingHandler { SubsequentStatusCodeToReturn = HttpStatusCode.OK }; + } + + #region DCR + [Fact] + [Trait("Category", "Scenario")] + public void CreateDcrTest() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + var dcrName = "dcrSdkCreateTest"; + MonitorManagementClient insightsClient = GetMonitorManagementClient(context, handler); + + var dcr = CreateDcr(insightsClient, dcrName); + Assert.NotNull(dcr); + + var dcrFromGet = insightsClient.DataCollectionRules.Get(ResourceGroupName, dcrName); + insightsClient.DataCollectionRules.Delete(ResourceGroupName, dcrName); + + AreEqual(dcr, dcrFromGet); + } + } + + [Fact] + [Trait("Category", "Scenario")] + public void DeleteDcrTest() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + var dcrName = "dcrSdkDeleteTest"; + MonitorManagementClient insightsClient = GetMonitorManagementClient(context, handler); + var dcrDelete = CreateDcr(insightsClient, dcrName); ; + + Assert.NotNull(dcrDelete); + + var dcrList = insightsClient.DataCollectionRules.ListByResourceGroup(ResourceGroupName).ToList(); + Assert.Equal(1, dcrList.Count(x => x.Name == dcrName)); + + insightsClient.DataCollectionRules.Delete(ResourceGroupName, dcrName); + + dcrList = insightsClient.DataCollectionRules.ListByResourceGroup(ResourceGroupName).ToList(); + Assert.Equal(0, dcrList.Count(x => x.Name == dcrName)); + } + } + + + [Fact] + [Trait("Category", "Scenario")] + public void ListDcrBySubscriptionTest() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + string[] dcrNames = { "dcrListOneTest", "dcrListTwoTest", "dcrListThreeTest", "dcrListFourTest" }; ; + MonitorManagementClient insightsClient = GetMonitorManagementClient(context, handler); + foreach (var dcrName in dcrNames) _ = CreateDcr(insightsClient, dcrName); + + var dcrList = insightsClient.DataCollectionRules.ListBySubscription().ToList(); + + Assert.NotNull(dcrList); + Assert.True(dcrList.Count >= 3, "List must be greather than 3 items"); + + foreach (var dcrName in dcrNames) + { + Assert.Equal(1, dcrList.Count(x => x.Name == dcrName)); + } + + foreach (var dcrName in dcrNames) insightsClient.DataCollectionRules.Delete(ResourceGroupName, dcrName); + } + } + + [Fact] + [Trait("Category", "Scenario")] + public void UpdateDcrTest() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + var dcrName = "dcrSdkUpdateTest"; + MonitorManagementClient insightsClient = GetMonitorManagementClient(context, handler); + + var dcr = CreateDcr(insightsClient, dcrName); + Assert.NotNull(dcr); + + dcr = insightsClient.DataCollectionRules.Update(ResourceGroupName, dcrName, new ResourceForUpdate { + Tags = new Dictionary + { + { "TagUpdated", "ValueUpdate" } + } + }); + Assert.NotNull(dcr); + + var dcrList = insightsClient.DataCollectionRules.ListByResourceGroup(ResourceGroupName).ToList(); + dcr = dcrList.FirstOrDefault(x => x.Name == dcrName); + Assert.NotNull(dcr); + Assert.True(dcr.Tags.Count == 1); + Assert.Equal("TagUpdated", dcr.Tags.Keys.First()); + Assert.Equal("ValueUpdate", dcr.Tags["TagUpdated"]); + + insightsClient.DataCollectionRules.Delete(ResourceGroupName, dcrName); + } + } + #endregion + + #region DCRA + [Fact] + [Trait("Category", "Scenario")] + public void DcrAssociationTest() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + var dcrName = "dcraSdkCreateTest"; + var dcraName = "dcraSdkCreateTestAssoc"; + MonitorManagementClient insightsClient = GetMonitorManagementClient(context, handler); + + var dcr = CreateDcr(insightsClient, dcrName); + Assert.NotNull(dcr); + + var dcra = insightsClient.DataCollectionRuleAssociations.Create(vmResourceUri, dcraName, new DataCollectionRuleAssociationProxyOnlyResource { + DataCollectionRuleId = dcr.Id, + Description = "Assoc with virtual machine" + }); + Assert.NotNull(dcra); + + var dcraListByRule = insightsClient.DataCollectionRuleAssociations.ListByRule(ResourceGroupName, dcrName); + Assert.Equal(1, dcraListByRule.Count(x => x.Name == dcraName.ToLower())); + + var dcraListByResource = insightsClient.DataCollectionRuleAssociations.ListByResource(vmResourceUri); + Assert.Equal(1, dcraListByResource.Count(x => x.Name == dcraName)); + + var dcraFromGet = insightsClient.DataCollectionRuleAssociations.Get(vmResourceUri, dcraName); + AreEqual(dcra, dcraFromGet); + + insightsClient.DataCollectionRuleAssociations.Delete(vmResourceUri, dcra.Name); + insightsClient.DataCollectionRules.Delete(ResourceGroupName, dcrName); + } + } + #endregion + + #region Helpers + private DataCollectionRuleResource CreateDcr(MonitorManagementClient insightsClient, string dcrName) + { + return insightsClient.DataCollectionRules.Create( + resourceGroupName: ResourceGroupName, + dataCollectionRuleName: dcrName, + new DataCollectionRuleResource + { + Location = "East US", + Tags = new Dictionary + { + { "tagOne", "valueOne" }, + { "tagTwo", "valueTwo" } + }, + DataSources = new DataCollectionRuleDataSources + { + PerformanceCounters = new List + { + new PerfCounterDataSource + { + Name = "perfCounterDataSource1", + Streams = new List { "Microsoft-InsightsMetrics" }, + ScheduledTransferPeriod = "PT1M", + SamplingFrequencyInSeconds = 10, + CounterSpecifiers = new List + { + "\\Memory\\% Committed Bytes In Use", + "\\Memory\\Available Bytes", + "\\Network Interface(*)\\Bytes Received/sec", + } + } + } + }, + Destinations = new DataCollectionRuleDestinations + { + AzureMonitorMetrics = new DestinationsSpecAzureMonitorMetrics { Name = "ammDestination" } + }, + DataFlows = new List + { + new DataFlow + { + Streams = new List{ "Microsoft-InsightsMetrics" }, + Destinations = new List{ "ammDestination" } + } + } + } + ); + } + #endregion + + #region DCR AreEqual Helpers + private static void AreEqual(DataCollectionRuleResource exp, DataCollectionRuleResource act) + { + if (exp != null) + { + Assert.Equal(exp.Id, act.Id); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Description, act.Description); + Assert.Equal(exp.Etag, act.Etag); + Assert.Equal(exp.Location, act.Location); + Assert.Equal(exp.ProvisioningState, act.ProvisioningState); + Assert.Equal(exp.Type, act.Type); + Utilities.AreEqual(exp.Tags, act.Tags); + + AreEqual(exp.DataFlows, act.DataFlows); + AreEqual(exp.DataSources, act.DataSources); + AreEqual(exp.Destinations, act.Destinations); + } + } + + private static void AreEqual(IList exp, IList act) + { + if (exp != null) + { + for (int i = 0; i < exp.Count; i++) + { + AreEqual(exp[i], act[i]); + } + } + } + + private static void AreEqual(DataCollectionRuleDataSources exp, DataCollectionRuleDataSources act) + { + if (exp != null) + { + if (exp.PerformanceCounters != null) + { + for (int i = 0; i < exp.PerformanceCounters.Count; i++) + { + AreEqual(exp.PerformanceCounters[i], act.PerformanceCounters[i]); + } + } + + if (exp.WindowsEventLogs != null) + { + for (int i = 0; i < exp.WindowsEventLogs.Count; i++) + { + AreEqual(exp.WindowsEventLogs[i], act.WindowsEventLogs[i]); + } + } + + if (exp.Syslog != null) + { + for (int i = 0; i < exp.Syslog.Count; i++) + { + AreEqual(exp.Syslog[i], act.Syslog[i]); + } + } + + if (exp.Extensions != null) + { + for (int i = 0; i < exp.Extensions.Count; i++) + { + AreEqual(exp.Extensions[i], act.Extensions[i]); + } + } + } + } + + private static void AreEqual(DataCollectionRuleDestinations exp, DataCollectionRuleDestinations act) + { + if (exp != null) + { + if (exp.AzureMonitorMetrics != null) + { + Assert.Equal(exp.AzureMonitorMetrics.Name, act.AzureMonitorMetrics.Name); + } + + if (exp.LogAnalytics != null) + { + for (int i = 0; i < exp.LogAnalytics.Count; i++) + { + AreEqual(exp.LogAnalytics[i], act.LogAnalytics[i]); + } + } + } + } + + private static void AreEqual(DataFlow exp, DataFlow act) + { + if (exp != null) + { + Assert.Equal(exp.Destinations.ToJson(), act.Destinations.ToJson()); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(PerfCounterDataSource exp, PerfCounterDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.CounterSpecifiers.ToJson(), act.CounterSpecifiers.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.SamplingFrequencyInSeconds, act.SamplingFrequencyInSeconds); + Assert.Equal(exp.ScheduledTransferPeriod, act.ScheduledTransferPeriod); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(WindowsEventLogDataSource exp, WindowsEventLogDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.ScheduledTransferPeriod, act.ScheduledTransferPeriod); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + Assert.Equal(exp.XPathQueries.ToJson(), act.XPathQueries.ToJson()); + } + } + + private static void AreEqual(SyslogDataSource exp, SyslogDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.FacilityNames.ToJson(), act.FacilityNames.ToJson()); + Assert.Equal(exp.LogLevels.ToJson(), act.LogLevels.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(ExtensionDataSource exp, ExtensionDataSource act) + { + if (exp != null) + { + Assert.Equal(exp.ExtensionName, act.ExtensionName); + Assert.Equal(exp.ExtensionSettings.ToJson(), act.ExtensionSettings.ToJson()); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.Streams.ToJson(), act.Streams.ToJson()); + } + } + + private static void AreEqual(LogAnalyticsDestination exp, LogAnalyticsDestination act) + { + if (exp != null) + { + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.WorkspaceResourceId, act.WorkspaceResourceId); + } + } + #endregion + + #region DCRA AreEqual Helpers} + private static void AreEqual(DataCollectionRuleAssociationProxyOnlyResource exp, DataCollectionRuleAssociationProxyOnlyResource act) + { + if (exp != null) + { + Assert.Equal(exp.DataCollectionRuleId.ToLower(), act.DataCollectionRuleId.ToLower()); + Assert.Equal(exp.Description, act.Description); + Assert.Equal(exp.Etag, act.Etag); + Assert.Equal(exp.Id, act.Id); + Assert.Equal(exp.Name, act.Name); + Assert.Equal(exp.ProvisioningState, act.ProvisioningState); + Assert.Equal(exp.Type, act.Type); + } + } + #endregion + } +} \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/CreateDcrTest.json b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/CreateDcrTest.json new file mode 100644 index 0000000000000..30791d9455052 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/CreateDcrTest.json @@ -0,0 +1,206 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkCreateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka0NyZWF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "c990a3df-2244-4a0c-b03d-707d6664eb57" + ], + "x-ms-correlation-request-id": [ + "c990a3df-2244-4a0c-b03d-707d6664eb57" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214842Z:c990a3df-2244-4a0c-b03d-707d6664eb57" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:42 GMT" + ], + "Content-Length": [ + "918" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-03184aa8f12f42b1916f82716ea853cb\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkCreateTest\",\r\n \"name\": \"dcrSdkCreateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900b118-0000-0100-0000-5f84cf390000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkCreateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka0NyZWF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "65873b34-ea34-49a3-88d1-0ef4704f69a7" + ], + "x-ms-correlation-request-id": [ + "65873b34-ea34-49a3-88d1-0ef4704f69a7" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214842Z:65873b34-ea34-49a3-88d1-0ef4704f69a7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:42 GMT" + ], + "Content-Length": [ + "918" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-03184aa8f12f42b1916f82716ea853cb\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkCreateTest\",\r\n \"name\": \"dcrSdkCreateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900b118-0000-0100-0000-5f84cf390000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkCreateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka0NyZWF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "89a725f5-c3c2-477c-9a48-56925438e833" + ], + "x-ms-correlation-request-id": [ + "89a725f5-c3c2-477c-9a48-56925438e833" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214844Z:89a725f5-c3c2-477c-9a48-56925438e833" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:43 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "63ca8f08-4d36-47a1-9467-03282553ad6b" + } +} \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DcrAssociationTest.json b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DcrAssociationTest.json new file mode 100644 index 0000000000000..0c1008394d172 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DcrAssociationTest.json @@ -0,0 +1,470 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjcmFTZGtDcmVhdGVUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "44044226-39f8-42ae-ae5f-8a539678a87e" + ], + "x-ms-correlation-request-id": [ + "44044226-39f8-42ae-ae5f-8a539678a87e" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214812Z:44044226-39f8-42ae-ae5f-8a539678a87e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:11 GMT" + ], + "Content-Length": [ + "920" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-ef227d2528e34cdd8a9989a36bc67eba\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest\",\r\n \"name\": \"dcraSdkCreateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"09009418-0000-0100-0000-5f84cf1b0000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc?api-version=2019-11-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzYzY2E4ZjA4LTRkMzYtNDdhMS05NDY3LTAzMjgyNTUzYWQ2Yi9yZXNvdXJjZWdyb3Vwcy9uZXRTZGtUZXN0UmVjb3JkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMvdm0tZGNyVGVzdFBwZS9wcm92aWRlcnMvTWljcm9zb2Z0Lkluc2lnaHRzL2RhdGFDb2xsZWN0aW9uUnVsZUFzc29jaWF0aW9ucy9kY3JhU2RrQ3JlYXRlVGVzdEFzc29jP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"description\": \"Assoc with virtual machine\",\r\n \"dataCollectionRuleId\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "260" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "d85cc35d-5023-4d1c-8011-9b3c89a9ec23" + ], + "x-ms-correlation-request-id": [ + "d85cc35d-5023-4d1c-8011-9b3c89a9ec23" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214813Z:d85cc35d-5023-4d1c-8011-9b3c89a9ec23" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:12 GMT" + ], + "Content-Length": [ + "608" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"description\": \"Assoc with virtual machine\",\r\n \"dataCollectionRuleId\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc\",\r\n \"name\": \"dcraSdkCreateTestAssoc\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRuleAssociations\",\r\n \"etag\": \"\\\"09009718-0000-0100-0000-5f84cf1d0000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest/associations?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjcmFTZGtDcmVhdGVUZXN0L2Fzc29jaWF0aW9ucz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "e426f3ae-2160-4d09-a51a-5a10437aca95" + ], + "x-ms-correlation-request-id": [ + "e426f3ae-2160-4d09-a51a-5a10437aca95" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214813Z:e426f3ae-2160-4d09-a51a-5a10437aca95" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:12 GMT" + ], + "Content-Length": [ + "543" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"dataCollectionRuleId\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netsdktestrecord/providers/microsoft.insights/datacollectionrules/dcrasdkcreatetest\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netsdktestrecord/providers/microsoft.compute/virtualmachines/vm-dcrtestppe/providers/microsoft.insights/datacollectionruleassociations/dcrasdkcreatetestassoc\",\r\n \"name\": \"dcrasdkcreatetestassoc\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRuleAssociations\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations?api-version=2019-11-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzYzY2E4ZjA4LTRkMzYtNDdhMS05NDY3LTAzMjgyNTUzYWQ2Yi9yZXNvdXJjZWdyb3Vwcy9uZXRTZGtUZXN0UmVjb3JkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMvdm0tZGNyVGVzdFBwZS9wcm92aWRlcnMvTWljcm9zb2Z0Lkluc2lnaHRzL2RhdGFDb2xsZWN0aW9uUnVsZUFzc29jaWF0aW9ucz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "b3fa9bbd-feed-442b-b05c-745e8a3c7f84" + ], + "x-ms-correlation-request-id": [ + "b3fa9bbd-feed-442b-b05c-745e8a3c7f84" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214813Z:b3fa9bbd-feed-442b-b05c-745e8a3c7f84" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:12 GMT" + ], + "Content-Length": [ + "636" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"description\": \"Assoc with virtual machine\",\r\n \"dataCollectionRuleId\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc\",\r\n \"name\": \"dcraSdkCreateTestAssoc\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRuleAssociations\",\r\n \"etag\": \"\\\"09009718-0000-0100-0000-5f84cf1d0000\\\"\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc?api-version=2019-11-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzYzY2E4ZjA4LTRkMzYtNDdhMS05NDY3LTAzMjgyNTUzYWQ2Yi9yZXNvdXJjZWdyb3Vwcy9uZXRTZGtUZXN0UmVjb3JkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMvdm0tZGNyVGVzdFBwZS9wcm92aWRlcnMvTWljcm9zb2Z0Lkluc2lnaHRzL2RhdGFDb2xsZWN0aW9uUnVsZUFzc29jaWF0aW9ucy9kY3JhU2RrQ3JlYXRlVGVzdEFzc29jP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "0f0d32ba-2584-419c-9d55-4f7f88ff3de6" + ], + "x-ms-correlation-request-id": [ + "0f0d32ba-2584-419c-9d55-4f7f88ff3de6" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214813Z:0f0d32ba-2584-419c-9d55-4f7f88ff3de6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:12 GMT" + ], + "Content-Length": [ + "608" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"description\": \"Assoc with virtual machine\",\r\n \"dataCollectionRuleId\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc\",\r\n \"name\": \"dcraSdkCreateTestAssoc\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRuleAssociations\",\r\n \"etag\": \"\\\"09009718-0000-0100-0000-5f84cf1d0000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourcegroups/netSdkTestRecord/providers/Microsoft.Compute/virtualMachines/vm-dcrTestPpe/providers/Microsoft.Insights/dataCollectionRuleAssociations/dcraSdkCreateTestAssoc?api-version=2019-11-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzYzY2E4ZjA4LTRkMzYtNDdhMS05NDY3LTAzMjgyNTUzYWQ2Yi9yZXNvdXJjZWdyb3Vwcy9uZXRTZGtUZXN0UmVjb3JkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMvdm0tZGNyVGVzdFBwZS9wcm92aWRlcnMvTWljcm9zb2Z0Lkluc2lnaHRzL2RhdGFDb2xsZWN0aW9uUnVsZUFzc29jaWF0aW9ucy9kY3JhU2RrQ3JlYXRlVGVzdEFzc29jP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "5b6bb839-ef1e-4124-b356-225e8e4bb798" + ], + "x-ms-correlation-request-id": [ + "5b6bb839-ef1e-4124-b356-225e8e4bb798" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214814Z:5b6bb839-ef1e-4124-b356-225e8e4bb798" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:13 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcraSdkCreateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjcmFTZGtDcmVhdGVUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14998" + ], + "x-ms-request-id": [ + "79dd8d4e-5be1-4b4f-99e5-7b718fbc63bd" + ], + "x-ms-correlation-request-id": [ + "79dd8d4e-5be1-4b4f-99e5-7b718fbc63bd" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214815Z:79dd8d4e-5be1-4b4f-99e5-7b718fbc63bd" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:15 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "63ca8f08-4d36-47a1-9467-03282553ad6b" + } +} \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DeleteDcrTest.json b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DeleteDcrTest.json new file mode 100644 index 0000000000000..2a4c23b1b45e8 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/DeleteDcrTest.json @@ -0,0 +1,260 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkDeleteTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka0RlbGV0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "c330f4e8-4fc3-4029-ad16-9c5fd4f76ca2" + ], + "x-ms-correlation-request-id": [ + "c330f4e8-4fc3-4029-ad16-9c5fd4f76ca2" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214825Z:c330f4e8-4fc3-4029-ad16-9c5fd4f76ca2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:24 GMT" + ], + "Content-Length": [ + "918" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-64783d85b6344fac99950711a3caa2f9\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkDeleteTest\",\r\n \"name\": \"dcrSdkDeleteTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a018-0000-0100-0000-5f84cf280000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "df800f71-a478-498c-82c5-51791b980ac1" + ], + "x-ms-correlation-request-id": [ + "df800f71-a478-498c-82c5-51791b980ac1" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214825Z:df800f71-a478-498c-82c5-51791b980ac1" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:25 GMT" + ], + "Content-Length": [ + "946" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-64783d85b6344fac99950711a3caa2f9\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkDeleteTest\",\r\n \"name\": \"dcrSdkDeleteTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a018-0000-0100-0000-5f84cf280000\\\"\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "5811df2d-28eb-4112-ad7b-c9f2157037d7" + ], + "x-ms-correlation-request-id": [ + "5811df2d-28eb-4112-ad7b-c9f2157037d7" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214826Z:5811df2d-28eb-4112-ad7b-c9f2157037d7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:26 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "12" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkDeleteTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka0RlbGV0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "0fed2b92-e3e7-4dee-8c97-864d228fa6e2" + ], + "x-ms-correlation-request-id": [ + "0fed2b92-e3e7-4dee-8c97-864d228fa6e2" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214826Z:0fed2b92-e3e7-4dee-8c97-864d228fa6e2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:26 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "63ca8f08-4d36-47a1-9467-03282553ad6b" + } +} \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/ListDcrBySubscriptionTest.json b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/ListDcrBySubscriptionTest.json new file mode 100644 index 0000000000000..9433fb9c16ab9 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/ListDcrBySubscriptionTest.json @@ -0,0 +1,602 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListOneTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RPbmVUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "d431a0c4-6c8a-4be1-b5d1-0e02f4c0b7ce" + ], + "x-ms-correlation-request-id": [ + "d431a0c4-6c8a-4be1-b5d1-0e02f4c0b7ce" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214830Z:d431a0c4-6c8a-4be1-b5d1-0e02f4c0b7ce" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:30 GMT" + ], + "Content-Length": [ + "914" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-8f4597f70210447eadfa1c64aa19216a\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListOneTest\",\r\n \"name\": \"dcrListOneTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a318-0000-0100-0000-5f84cf2d0000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListTwoTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RUd29UZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "58" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "16f27d66-a2ae-445b-8745-3c52707265ff" + ], + "x-ms-correlation-request-id": [ + "16f27d66-a2ae-445b-8745-3c52707265ff" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214831Z:16f27d66-a2ae-445b-8745-3c52707265ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:31 GMT" + ], + "Content-Length": [ + "914" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-e32c51df50f648e1819e3c3b409b2d05\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListTwoTest\",\r\n \"name\": \"dcrListTwoTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a518-0000-0100-0000-5f84cf2f0000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListThreeTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RUaHJlZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "57" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "62a61e78-7c07-451c-8c2b-25f14e98869d" + ], + "x-ms-correlation-request-id": [ + "62a61e78-7c07-451c-8c2b-25f14e98869d" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214833Z:62a61e78-7c07-451c-8c2b-25f14e98869d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:32 GMT" + ], + "Content-Length": [ + "918" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-723a60d6acd944248243dce1840207c6\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListThreeTest\",\r\n \"name\": \"dcrListThreeTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a718-0000-0100-0000-5f84cf300000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListFourTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RGb3VyVGVzdD9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "56" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "558ed437-afce-4ed3-b37d-87cf60713066" + ], + "x-ms-correlation-request-id": [ + "558ed437-afce-4ed3-b37d-87cf60713066" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214834Z:558ed437-afce-4ed3-b37d-87cf60713066" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:34 GMT" + ], + "Content-Length": [ + "916" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-82088d8a31df433fac2ef33389329f48\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListFourTest\",\r\n \"name\": \"dcrListFourTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900aa18-0000-0100-0000-5f84cf310000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/providers/Microsoft.Insights/dataCollectionRules?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Byb3ZpZGVycy9NaWNyb3NvZnQuSW5zaWdodHMvZGF0YUNvbGxlY3Rpb25SdWxlcz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "4b5bebec-f72a-4d20-8830-c3114d69ad90" + ], + "x-ms-correlation-request-id": [ + "4b5bebec-f72a-4d20-8830-c3114d69ad90" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214834Z:4b5bebec-f72a-4d20-8830-c3114d69ad90" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:34 GMT" + ], + "Content-Length": [ + "3693" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-8f4597f70210447eadfa1c64aa19216a\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListOneTest\",\r\n \"name\": \"dcrListOneTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a318-0000-0100-0000-5f84cf2d0000\\\"\"\r\n },\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-e32c51df50f648e1819e3c3b409b2d05\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListTwoTest\",\r\n \"name\": \"dcrListTwoTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a518-0000-0100-0000-5f84cf2f0000\\\"\"\r\n },\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-723a60d6acd944248243dce1840207c6\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListThreeTest\",\r\n \"name\": \"dcrListThreeTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900a718-0000-0100-0000-5f84cf300000\\\"\"\r\n },\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-82088d8a31df433fac2ef33389329f48\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListFourTest\",\r\n \"name\": \"dcrListFourTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"0900aa18-0000-0100-0000-5f84cf310000\\\"\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListOneTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RPbmVUZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "d94fef02-b161-4d36-b22e-159f27ba787b" + ], + "x-ms-correlation-request-id": [ + "d94fef02-b161-4d36-b22e-159f27ba787b" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214835Z:d94fef02-b161-4d36-b22e-159f27ba787b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:35 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListTwoTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RUd29UZXN0P2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14998" + ], + "x-ms-request-id": [ + "511e63e3-682b-44dc-bb92-4ceb1d893117" + ], + "x-ms-correlation-request-id": [ + "511e63e3-682b-44dc-bb92-4ceb1d893117" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214837Z:511e63e3-682b-44dc-bb92-4ceb1d893117" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:36 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListThreeTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RUaHJlZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14997" + ], + "x-ms-request-id": [ + "fc2d3acc-66a4-4764-a5e4-f956ea8fcb70" + ], + "x-ms-correlation-request-id": [ + "fc2d3acc-66a4-4764-a5e4-f956ea8fcb70" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214838Z:fc2d3acc-66a4-4764-a5e4-f956ea8fcb70" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:37 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrListFourTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2Rjckxpc3RGb3VyVGVzdD9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14996" + ], + "x-ms-request-id": [ + "64d47200-ad14-4ca5-b21e-33ec37abff9f" + ], + "x-ms-correlation-request-id": [ + "64d47200-ad14-4ca5-b21e-33ec37abff9f" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214839Z:64d47200-ad14-4ca5-b21e-33ec37abff9f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:38 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "63ca8f08-4d36-47a1-9467-03282553ad6b" + } +} \ No newline at end of file diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/UpdateDcrTest.json b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/UpdateDcrTest.json new file mode 100644 index 0000000000000..269e9db01767d --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/tests/SessionRecords/DataCollectionRulesTests/UpdateDcrTest.json @@ -0,0 +1,278 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka1VwZGF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "922" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "59" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "97ade7cb-d664-462a-8619-74b188853351" + ], + "x-ms-correlation-request-id": [ + "97ade7cb-d664-462a-8619-74b188853351" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214819Z:97ade7cb-d664-462a-8619-74b188853351" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:19 GMT" + ], + "Content-Length": [ + "918" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-5da7ff8931b14b5c906be20efc52390b\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"tagOne\": \"valueOne\",\r\n \"tagTwo\": \"valueTwo\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest\",\r\n \"name\": \"dcrSdkUpdateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"09009b18-0000-0100-0000-5f84cf220000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka1VwZGF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "PATCH", + "RequestBody": "{\r\n \"tags\": {\r\n \"TagUpdated\": \"ValueUpdate\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "55" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "58" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "d1c17a40-bfbe-4c9d-ba81-a538368c30c2" + ], + "x-ms-correlation-request-id": [ + "d1c17a40-bfbe-4c9d-ba81-a538368c30c2" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214820Z:d1c17a40-bfbe-4c9d-ba81-a538368c30c2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:20 GMT" + ], + "Content-Length": [ + "905" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"immutableId\": \"dcr-5da7ff8931b14b5c906be20efc52390b\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"TagUpdated\": \"ValueUpdate\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest\",\r\n \"name\": \"dcrSdkUpdateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"09009d18-0000-0100-0000-5f84cf240000\\\"\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": [ + "133bc45c-be75-4f7d-bc25-a7a2c7e805df" + ], + "x-ms-correlation-request-id": [ + "133bc45c-be75-4f7d-bc25-a7a2c7e805df" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214820Z:133bc45c-be75-4f7d-bc25-a7a2c7e805df" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:20 GMT" + ], + "Content-Length": [ + "933" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"immutableId\": \"dcr-5da7ff8931b14b5c906be20efc52390b\",\r\n \"dataSources\": {\r\n \"performanceCounters\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"scheduledTransferPeriod\": \"PT1M\",\r\n \"samplingFrequencyInSeconds\": 10,\r\n \"counterSpecifiers\": [\r\n \"\\\\Memory\\\\% Committed Bytes In Use\",\r\n \"\\\\Memory\\\\Available Bytes\",\r\n \"\\\\Network Interface(*)\\\\Bytes Received/sec\"\r\n ],\r\n \"name\": \"perfCounterDataSource1\"\r\n }\r\n ]\r\n },\r\n \"destinations\": {\r\n \"azureMonitorMetrics\": {\r\n \"name\": \"ammDestination\"\r\n }\r\n },\r\n \"dataFlows\": [\r\n {\r\n \"streams\": [\r\n \"Microsoft-InsightsMetrics\"\r\n ],\r\n \"destinations\": [\r\n \"ammDestination\"\r\n ]\r\n }\r\n ],\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {\r\n \"TagUpdated\": \"ValueUpdate\"\r\n },\r\n \"id\": \"/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest\",\r\n \"name\": \"dcrSdkUpdateTest\",\r\n \"type\": \"Microsoft.Insights/dataCollectionRules\",\r\n \"etag\": \"\\\"09009d18-0000-0100-0000-5f84cf240000\\\"\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/63ca8f08-4d36-47a1-9467-03282553ad6b/resourceGroups/netSdkTestRecord/providers/Microsoft.Insights/dataCollectionRules/dcrSdkUpdateTest?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjNjYThmMDgtNGQzNi00N2ExLTk0NjctMDMyODI1NTNhZDZiL3Jlc291cmNlR3JvdXBzL25ldFNka1Rlc3RSZWNvcmQvcHJvdmlkZXJzL01pY3Jvc29mdC5JbnNpZ2h0cy9kYXRhQ29sbGVjdGlvblJ1bGVzL2RjclNka1VwZGF0ZVRlc3Q/YXBpLXZlcnNpb249MjAxOS0xMS0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29220.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19042.", + "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Request-Context": [ + "appId=cid-v1:2bbfbac8-e1b0-44af-b9c6-3a40669d37e3" + ], + "api-supported-versions": [ + "2019-11-01-preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "757d9654-0958-4d26-b646-f2f023ff29c8" + ], + "x-ms-correlation-request-id": [ + "757d9654-0958-4d26-b646-f2f023ff29c8" + ], + "x-ms-routing-request-id": [ + "SOUTHCENTRALUS:20201012T214821Z:757d9654-0958-4d26-b646-f2f023ff29c8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 12 Oct 2020 21:48:21 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "63ca8f08-4d36-47a1-9467-03282553ad6b" + } +} \ No newline at end of file