From 6845e350ee05edc469b6ba080f7efb531af44426 Mon Sep 17 00:00:00 2001 From: Jorge Herrera <69991673+herreraj-ms@users.noreply.github.com> Date: Wed, 14 Oct 2020 13:44:49 -0500 Subject: [PATCH] Data collection rules 2019-11-01-preview (#15789) * Autorest codeGen; Removing Error*.cs models * Autorest DCR adjust: Set apiVersion to 219-11-01-preview in DCR * DCR & DCRA * Adding DCRA & Testing * Update on csproj & RP.props file * Update monitor_resource-manager.txt & SdkInfo changes * Fix Creadential in DCR & DCRA service operation API; Add Recorded Session Test --- .../mgmtmetadata/monitor_resource-manager.txt | 6 +- .../AzSdk.RP.props | 2 +- .../DataCollectionRuleAssociations.cs | 1010 +++++++++++++ ...ataCollectionRuleAssociationsExtensions.cs | 217 +++ .../src/Generated/DataCollectionRules.cs | 1262 +++++++++++++++++ .../DataCollectionRulesExtensions.cs | 251 ++++ .../IDataCollectionRuleAssociations.cs | 146 ++ .../src/Generated/IDataCollectionRules.cs | 168 +++ .../src/Generated/IMonitorManagementClient.cs | 9 + .../Models/AzureMonitorMetricsDestination.cs | 67 + ...lectionRuleAssociationProxyOnlyResource.cs | 96 ++ .../Models/DataCollectionRuleDataSources.cs | 53 + .../Models/DataCollectionRuleDestinations.cs | 47 + .../Models/DataCollectionRuleResource.cs | 139 ++ .../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 | 110 ++ .../Models/LogAnalyticsDestination.cs | 78 + .../Generated/Models/PerfCounterDataSource.cs | 143 ++ .../src/Generated/Models/ResourceForUpdate.cs | 50 + .../src/Generated/Models/SyslogDataSource.cs | 107 ++ .../Models/WindowsEventLogDataSource.cs | 117 ++ .../src/Generated/MonitorManagementClient.cs | 13 + .../src/Generated/SdkInfo_MonitorClient.cs | 6 +- .../Microsoft.Azure.Management.Monitor.csproj | 7 +- .../BasicTests/DataCollectionRulesTests.cs | 550 +++++++ .../Scenarios/DataCollectionRulesTests.cs | 380 +++++ .../CreateDcrTest.json | 206 +++ .../DcrAssociationTest.json | 470 ++++++ .../DeleteDcrTest.json | 260 ++++ .../ListDcrBySubscriptionTest.json | 602 ++++++++ .../UpdateDcrTest.json | 278 ++++ 34 files changed, 7110 insertions(+), 9 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/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/IDataCollectionRuleAssociations.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/DataCollectionRuleAssociationProxyOnlyResource.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/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/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 create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/tests/BasicTests/DataCollectionRulesTests.cs 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/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/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/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs new file mode 100644 index 0000000000000..4fae9f9b9192a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs @@ -0,0 +1,1010 @@ +// +// 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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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..cb5e017e2e08e --- /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 Page 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 Page 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 new file mode 100644 index 0000000000000..8b5de5f0a032a --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs @@ -0,0 +1,1262 @@ +// +// 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\\._\\(\\)]+$"); + } + } + 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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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); + } + } + 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("apiVersion", apiVersion); + 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 (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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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\\._\\(\\)]+$"); + } + } + 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, "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 (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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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 (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("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); + 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("/") ? "" : "/")), "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 (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"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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\\._\\(\\)]+$"); + } + } + 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("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 (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("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"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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\\._\\(\\)]+$"); + } + } + 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, "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 (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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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..1c443c8cbf1aa --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs @@ -0,0 +1,251 @@ +// +// 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 Page 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 Page 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/IDataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs new file mode 100644 index 0000000000000..cdceddf6a90a9 --- /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 new file mode 100644 index 0000000000000..1002215a1d476 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs @@ -0,0 +1,168 @@ +// +// 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..dc566c7a40578 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,14 @@ public partial interface IMonitorManagementClient : System.IDisposable /// IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; } + /// + /// 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 new file mode 100644 index 0000000000000..024b31b45b870 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs @@ -0,0 +1,67 @@ +// +// 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"); + } + } + } +} 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..96789654534da --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs @@ -0,0 +1,96 @@ +// +// 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; + + /// + /// Definition of generic ARM proxy resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DataCollectionRuleAssociationProxyOnlyResource : ProxyOnlyResource + { + /// + /// 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)) + : base(id, name, type) + { + Description = description; + DataCollectionRuleId = dataCollectionRuleId; + ProvisioningState = provisioningState; + 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 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/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..4d31b6a37da8b --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs @@ -0,0 +1,139 @@ +// +// 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.Generic; + + /// + /// Definition of ARM tracked top level resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DataCollectionRuleResource : Resource + { + /// + /// 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)) + : base(location, id, name, type, tags) + { + Description = description; + DataSources = dataSources; + Destinations = destinations; + DataFlows = dataFlows; + ProvisioningState = provisioningState; + Location = location; + 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 resource entity tag (ETag). + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.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 (DataFlows != null) + { + foreach (var element in DataFlows) + { + 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..be46e72de05a5 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs @@ -0,0 +1,110 @@ +// +// 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"); + } + } + } +} 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..8d2e2410d2a13 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs @@ -0,0 +1,78 @@ +// +// 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"); + } + } + } +} 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..6d519443ccec2 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs @@ -0,0 +1,143 @@ +// +// 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); + } + } + } +} 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..f3106d2c8e3df --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs @@ -0,0 +1,107 @@ +// +// 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"); + } + } + } +} 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..61f6f218370f7 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs @@ -0,0 +1,117 @@ +// +// 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"); + } + } + } +} 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..aedbcd71c6ab5 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,17 @@ public partial class MonitorManagementClient : ServiceClient public virtual IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; private set; } + /// + /// Gets the IDataCollectionRules. + /// + 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. /// @@ -466,6 +477,8 @@ private void Initialize() PrivateLinkResources = new PrivateLinkResourcesOperations(this); 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; 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 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** 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 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