From 5c552d8288eed87228be7ff15dc3bd2ac08749d9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 20 Jan 2021 07:30:42 +0000 Subject: [PATCH] CodeGen from PR 12512 in Azure/azure-rest-api-specs Merge bc90aa78e16db157467747139aacc0b81d805f62 into c8afc7402e3cd05564287fbd7476aa8d3ee17a5e --- .../src/Generated/ActionGroupsOperations.cs | 49 + .../Generated/ActivityLogAlertsOperations.cs | 42 + .../src/Generated/ActivityLogsOperations.cs | 7 + .../Generated/AlertRuleIncidentsOperations.cs | 14 + .../src/Generated/AlertRulesOperations.cs | 98 +- .../Generated/AutoscaleSettingsOperations.cs | 42 + .../src/Generated/BaselinesOperations.cs | 2 +- .../DataCollectionRuleAssociations.cs | 1010 ----------- ...ataCollectionRuleAssociationsExtensions.cs | 217 --- .../src/Generated/DataCollectionRules.cs | 1262 ------------- .../DataCollectionRulesExtensions.cs | 251 --- .../src/Generated/IAlertRulesOperations.cs | 8 +- .../IDataCollectionRuleAssociations.cs | 146 -- .../src/Generated/IDataCollectionRules.cs | 168 -- .../src/Generated/IMetricAlertsOperations.cs | 2 +- .../src/Generated/IMonitorManagementClient.cs | 36 +- .../IPrivateEndpointConnectionsOperations.cs | 212 --- .../IPrivateLinkResourcesOperations.cs | 105 -- ...ivateLinkScopeOperationStatusOperations.cs | 53 - .../IPrivateLinkScopedResourcesOperations.cs | 214 --- .../Generated/IPrivateLinkScopesOperations.cs | 245 --- .../src/Generated/LogProfilesOperations.cs | 35 + .../src/Generated/MetricAlertsOperations.cs | 53 +- .../Generated/MetricAlertsStatusOperations.cs | 14 + .../src/Generated/MetricBaselineOperations.cs | 2 +- .../Generated/Models/AggregationTypeEnum.cs | 25 + .../Models/AzureMonitorMetricsDestination.cs | 67 - .../Models/AzureMonitorPrivateLinkScope.cs | 100 -- .../src/Generated/Models/Baseline.cs | 11 +- ...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/DynamicMetricCriteria.cs | 7 +- .../Generated/Models/ErrorAdditionalInfo.cs | 59 - .../Generated/Models/ErrorResponseCommon.cs | 65 - .../Models/ErrorResponseCommonException.cs | 62 - .../Generated/Models/ExtensionDataSource.cs | 110 -- .../Models/LogAnalyticsDestination.cs | 78 - .../src/Generated/Models/MetricAlertAction.cs | 9 +- .../Generated/Models/MetricAlertResource.cs | 41 +- .../Models/MetricAlertResourcePatch.cs | 42 +- .../src/Generated/Models/MetricCriteria.cs | 7 +- .../Generated/Models/MultiMetricCriteria.cs | 12 +- .../src/Generated/Models/OperationStatus.cs | 94 - .../Generated/Models/PerfCounterDataSource.cs | 143 -- .../Models/PrivateEndpointConnection.cs | 90 - .../Models/PrivateEndpointProperty.cs | 51 - .../Generated/Models/PrivateLinkResource.cs | 69 - .../Models/PrivateLinkScopesResource.cs | 100 -- ...ivateLinkServiceConnectionStateProperty.cs | 90 - .../src/Generated/Models/ResourceForUpdate.cs | 50 - .../src/Generated/Models/ScopedResource.cs | 68 - .../src/Generated/Models/SyslogDataSource.cs | 107 -- .../src/Generated/Models/TagsResource.cs | 54 - .../Generated/Models/TimeSeriesBaseline.cs | 14 +- .../Models/WindowsEventLogDataSource.cs | 117 -- .../src/Generated/MonitorManagementClient.cs | 45 +- .../PrivateEndpointConnectionsOperations.cs | 1078 ----------- ...EndpointConnectionsOperationsExtensions.cs | 331 ---- .../PrivateLinkResourcesOperations.cs | 627 ------- ...rivateLinkResourcesOperationsExtensions.cs | 151 -- ...ivateLinkScopeOperationStatusOperations.cs | 249 --- ...copeOperationStatusOperationsExtensions.cs | 67 - .../PrivateLinkScopedResourcesOperations.cs | 1095 ----------- ...LinkScopedResourcesOperationsExtensions.cs | 335 ---- .../Generated/PrivateLinkScopesOperations.cs | 1593 ----------------- .../PrivateLinkScopesOperationsExtensions.cs | 371 ---- .../ScheduledQueryRulesOperations.cs | 42 + .../src/Generated/SdkInfo_MonitorClient.cs | 23 +- 74 files changed, 468 insertions(+), 12172 deletions(-) delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationTypeEnum.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs index e1e63466085b6..97e4eaf12a0e1 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs @@ -105,6 +105,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -319,6 +326,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -505,6 +519,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -672,6 +693,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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"); @@ -866,6 +894,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1044,6 +1079,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1233,6 +1275,13 @@ internal ActionGroupsOperations(MonitorManagementClient client) { 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 (receiverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "receiverName"); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs index 861e5a5c1e240..3320c92887776 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs @@ -89,6 +89,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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"); @@ -311,6 +318,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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"); @@ -497,6 +511,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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"); @@ -672,6 +693,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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"); @@ -866,6 +894,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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 = "2017-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1040,6 +1075,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { 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"); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs index 0bb485558e709..e6b628ea59b63 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs @@ -97,6 +97,13 @@ internal ActivityLogsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs index 4f17f6c37e44c..7b2a975fc85a5 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs @@ -101,6 +101,13 @@ internal AlertRuleIncidentsOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -292,6 +299,13 @@ internal AlertRuleIncidentsOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs index 992f576643d7f..5a1f02578cd2d 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs @@ -105,6 +105,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -122,7 +129,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -290,7 +297,7 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -316,6 +323,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -332,7 +346,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -401,14 +415,13 @@ internal AlertRulesOperations(MonitorManagementClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -418,10 +431,6 @@ internal AlertRulesOperations(MonitorManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -463,7 +472,7 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -492,6 +501,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -508,7 +524,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -577,14 +593,13 @@ internal AlertRulesOperations(MonitorManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -594,10 +609,6 @@ internal AlertRulesOperations(MonitorManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -682,6 +693,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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"); @@ -711,7 +729,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); @@ -876,7 +894,7 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -901,6 +919,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -916,7 +941,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); @@ -984,14 +1009,13 @@ internal AlertRulesOperations(MonitorManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1001,10 +1025,6 @@ internal AlertRulesOperations(MonitorManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1058,7 +1078,7 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1079,6 +1099,13 @@ internal AlertRulesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1093,7 +1120,7 @@ internal AlertRulesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -1160,14 +1187,13 @@ internal AlertRulesOperations(MonitorManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1177,10 +1203,6 @@ internal AlertRulesOperations(MonitorManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs index 2d2193992b4bd..e613ac64a9cb5 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs @@ -87,6 +87,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -285,6 +292,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -496,6 +510,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -667,6 +688,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -852,6 +880,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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"); @@ -1046,6 +1081,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) { 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 = "2015-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs index 49715e977715f..c3e5a5f0b47a2 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs @@ -142,7 +142,7 @@ internal BaselinesOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricBaselines").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metricBaselines").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); List _queryParameters = new List(); if (metricnames != null) diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs deleted file mode 100644 index 4fae9f9b9192a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs +++ /dev/null @@ -1,1010 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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 deleted file mode 100644 index cb5e017e2e08e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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 deleted file mode 100644 index 8b5de5f0a032a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ /dev/null @@ -1,1262 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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 deleted file mode 100644 index 1c443c8cbf1aa..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs +++ /dev/null @@ -1,251 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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/IAlertRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs index 9a365ee836ed7..b795ded7566d1 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs @@ -66,7 +66,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -88,7 +88,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -139,7 +139,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -158,7 +158,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs deleted file mode 100644 index cdceddf6a90a9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs +++ /dev/null @@ -1,146 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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 deleted file mode 100644 index 1002215a1d476..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - 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/IMetricAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs index ec52f97ca1dc8..e16e06fabb0d3 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs @@ -160,7 +160,7 @@ public partial interface IMetricAlertsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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 dc566c7a40578..1527303c37e94 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs @@ -41,7 +41,7 @@ public partial interface IMonitorManagementClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// The Azure subscription Id. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } @@ -169,39 +169,5 @@ public partial interface IMonitorManagementClient : System.IDisposable /// IVMInsightsOperations VMInsights { get; } - /// - /// Gets the IPrivateLinkScopesOperations. - /// - IPrivateLinkScopesOperations PrivateLinkScopes { get; } - - /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. - /// - IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; } - - /// - /// Gets the IPrivateLinkResourcesOperations. - /// - IPrivateLinkResourcesOperations PrivateLinkResources { get; } - - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } - - /// - /// Gets the IPrivateLinkScopedResourcesOperations. - /// - 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/IPrivateEndpointConnectionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs deleted file mode 100644 index a7ba557f35670..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,212 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - public partial interface IPrivateEndpointConnectionsOperations - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// 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 scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// 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 scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs deleted file mode 100644 index 0f99e2a8db8cb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkResourcesOperations operations. - /// - public partial interface IPrivateLinkResourcesOperations - { - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link 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> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs deleted file mode 100644 index 45e67dbd6f896..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopeOperationStatusOperations operations. - /// - public partial interface IPrivateLinkScopeOperationStatusOperations - { - /// - /// Get the status of an azure asynchronous operation associated with a - /// private link scope operation. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs deleted file mode 100644 index 5e9aae6b02e5e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopedResourcesOperations operations. - /// - public partial interface IPrivateLinkScopedResourcesOperations - { - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// 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 scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// 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 scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs deleted file mode 100644 index 764f73ca2ff60..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs +++ /dev/null @@ -1,245 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopesOperations operations. - /// - public partial interface IPrivateLinkScopesOperations - { - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. - /// - /// - /// The name of the resource group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// 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 scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You - /// cannot specify a different value for InstrumentationKey nor AppId - /// in the Put operation. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields - /// use the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs index 22c26c0894b2c..476c7c5993e46 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs @@ -84,6 +84,13 @@ internal LogProfilesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -251,6 +258,13 @@ internal LogProfilesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -442,6 +456,13 @@ internal LogProfilesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -634,6 +655,13 @@ internal LogProfilesOperations(MonitorManagementClient client) { 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 (logProfileName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); @@ -822,6 +850,13 @@ internal LogProfilesOperations(MonitorManagementClient client) { 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 = "2016-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs index 212520cb0f36c..17b69e75be5f8 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs @@ -80,6 +80,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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 = "2018-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -254,6 +261,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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"); @@ -437,6 +451,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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"); @@ -629,6 +650,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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"); @@ -836,6 +864,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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"); @@ -1015,7 +1050,7 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1033,6 +1068,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) { 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"); @@ -1126,14 +1168,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1143,10 +1184,6 @@ internal MetricAlertsOperations(MonitorManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs index 2fc747a557515..09d82122d2005 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs @@ -86,6 +86,13 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) { 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"); @@ -278,6 +285,13 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) { 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"); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs index 048ca649aaf3c..9cda6059c92ea 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs @@ -131,7 +131,7 @@ internal MetricBaselineOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/baseline/{metricName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); _url = _url.Replace("{metricName}", System.Uri.EscapeDataString(metricName)); List _queryParameters = new List(); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationTypeEnum.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationTypeEnum.cs new file mode 100644 index 0000000000000..e2007d5c8ddcd --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationTypeEnum.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for AggregationTypeEnum. + /// + public static class AggregationTypeEnum + { + public const string Average = "Average"; + public const string Count = "Count"; + public const string Minimum = "Minimum"; + public const string Maximum = "Maximum"; + public const string Total = "Total"; + } +} 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 deleted file mode 100644 index 024b31b45b870..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// 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/AzureMonitorPrivateLinkScope.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs deleted file mode 100644 index 47dbcf85231d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An Azure Monitor PrivateLinkScope definition. - /// - [Rest.Serialization.JsonTransformation] - public partial class AzureMonitorPrivateLinkScope : PrivateLinkScopesResource - { - /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. - /// - public AzureMonitorPrivateLinkScope() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. - /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// Current state of this - /// PrivateLinkScope: whether or not is has been provisioned within the - /// resource group it is defined. Users cannot change this value but - /// are able to read from it. Values will include Provisioning - /// ,Succeeded, Canceled and Failed. - /// List of private endpoint - /// connections. - public AzureMonitorPrivateLinkScope(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), IList privateEndpointConnections = default(IList)) - : base(location, id, name, type, tags) - { - ProvisioningState = provisioningState; - PrivateEndpointConnections = privateEndpointConnections; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets current state of this PrivateLinkScope: whether or not is has - /// been provisioned within the resource group it is defined. Users - /// cannot change this value but are able to read from it. Values will - /// include Provisioning ,Succeeded, Canceled and Failed. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets list of private endpoint connections. - /// - [JsonProperty(PropertyName = "properties.privateEndpointConnections")] - public IList PrivateEndpointConnections { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (PrivateEndpointConnections != null) - { - foreach (var element in PrivateEndpointConnections) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs index 2aefd3ac9a2c3..83a721dd2d132 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs @@ -38,11 +38,14 @@ public Baseline() /// baseline. /// The high thresholds of the /// baseline. - public Baseline(Sensitivity sensitivity, IList lowThresholds, IList highThresholds) + /// the array of timestamps of the + /// baselines. + public Baseline(Sensitivity sensitivity, IList lowThresholds, IList highThresholds, IList timestamps = default(IList)) { Sensitivity = sensitivity; LowThresholds = lowThresholds; HighThresholds = highThresholds; + Timestamps = timestamps; CustomInit(); } @@ -70,6 +73,12 @@ public Baseline(Sensitivity sensitivity, IList lowThresholds, IList HighThresholds { get; set; } + /// + /// Gets or sets the array of timestamps of the baselines. + /// + [JsonProperty(PropertyName = "timestamps")] + public IList Timestamps { get; set; } + /// /// Validate the object. /// 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 deleted file mode 100644 index 96789654534da..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - - /// - /// 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 deleted file mode 100644 index a8f31f4b717d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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 deleted file mode 100644 index 99cb30cf99024..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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 deleted file mode 100644 index 4d31b6a37da8b..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs +++ /dev/null @@ -1,139 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections.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 deleted file mode 100644 index 9415dd42828af..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of 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 deleted file mode 100644 index f66eda00cfff0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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 deleted file mode 100644 index 5288b0fb67ecb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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 deleted file mode 100644 index 93d723887d24e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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/DynamicMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs index 7b8099392e660..8dad3fa1d3f0e 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs @@ -35,8 +35,9 @@ public DynamicMetricCriteria() /// /// Name of the criteria. /// Name of the metric. - /// the criteria time aggregation - /// types. + /// the criteria time aggregation types. + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' /// The operator used to compare the /// metric value against the threshold. Possible values include: /// 'GreaterThan', 'LessThan', 'GreaterOrLessThan' @@ -57,7 +58,7 @@ public DynamicMetricCriteria() /// Use this option to set the date from /// which to start learning the metric historical data and calculate /// the dynamic thresholds (in ISO8601 format) - public DynamicMetricCriteria(string name, string metricName, object timeAggregation, string operatorProperty, string alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?), System.DateTime? ignoreDataBefore = default(System.DateTime?)) + public DynamicMetricCriteria(string name, string metricName, string timeAggregation, string operatorProperty, string alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?), System.DateTime? ignoreDataBefore = default(System.DateTime?)) : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) { OperatorProperty = operatorProperty; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs deleted file mode 100644 index 05bf1fbd6ec39..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The resource management error additional info. - /// - public partial class ErrorAdditionalInfo - { - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - public ErrorAdditionalInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - /// The additional info type. - /// The additional info. - public ErrorAdditionalInfo(string type = default(string), object info = default(object)) - { - Type = type; - Info = info; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the additional info type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the additional info. - /// - [JsonProperty(PropertyName = "info")] - public object Info { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs deleted file mode 100644 index 03e89dfa4cbc1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The resource management error response. - /// - public partial class ErrorResponseCommon : ErrorResponse - { - /// - /// Initializes a new instance of the ErrorResponseCommon class. - /// - public ErrorResponseCommon() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponseCommon class. - /// - /// Error code - /// Error message indicating why the operation - /// failed. - /// The error details. - /// The error additional info. - public ErrorResponseCommon(string code = default(string), string message = default(string), IList details = default(IList), IList additionalInfo = default(IList)) - : base(code, message) - { - Details = details; - AdditionalInfo = additionalInfo; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } - - /// - /// Gets the error additional info. - /// - [JsonProperty(PropertyName = "additionalInfo")] - public IList AdditionalInfo { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs deleted file mode 100644 index f68f9794927a1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with ErrorResponseCommon - /// information. - /// - public partial class ErrorResponseCommonException : RestException - { - /// - /// Gets information about the associated HTTP request. - /// - public HttpRequestMessageWrapper Request { get; set; } - - /// - /// Gets information about the associated HTTP response. - /// - public HttpResponseMessageWrapper Response { get; set; } - - /// - /// Gets or sets the body object. - /// - public ErrorResponseCommon Body { get; set; } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - public ErrorResponseCommonException() - { - } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - /// The exception message. - public ErrorResponseCommonException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - /// The exception message. - /// Inner exception. - public ErrorResponseCommonException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} 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 deleted file mode 100644 index be46e72de05a5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of 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 deleted file mode 100644 index 8d2e2410d2a13..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// 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/MetricAlertAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs index b350094e1de43..34d8307f5947d 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs @@ -33,8 +33,9 @@ public MetricAlertAction() /// /// the id of the action group to /// use. - /// The properties of a webhook - /// object. + /// This field allows specifying custom + /// properties, which would be appended to the alert payload sent as + /// input to the webhook. public MetricAlertAction(string actionGroupId = default(string), IDictionary webHookProperties = default(IDictionary)) { ActionGroupId = actionGroupId; @@ -54,7 +55,9 @@ public MetricAlertAction() public string ActionGroupId { get; set; } /// - /// Gets or sets the properties of a webhook object. + /// Gets or sets this field allows specifying custom properties, which + /// would be appended to the alert payload sent as input to the + /// webhook. /// [JsonProperty(PropertyName = "webHookProperties")] public IDictionary WebHookProperties { get; set; } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs index 1dc4c60ad162d..cc8dc33b5d681 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs @@ -35,11 +35,11 @@ public MetricAlertResource() /// Initializes a new instance of the MetricAlertResource class. /// /// Resource location - /// the description of the metric alert that - /// will be included in the alert email. /// Alert severity {0, 1, 2, 3, 4} /// the flag that indicates whether the metric /// alert is enabled. + /// the list of resource id's that this metric + /// alert is scoped to. /// how often the metric alert is /// evaluated represented in ISO 8601 duration format. /// the period of time (in ISO 8601 duration @@ -51,14 +51,16 @@ public MetricAlertResource() /// Azure resource name /// Azure resource type /// Resource tags - /// the list of resource id's that this metric - /// alert is scoped to. + /// the description of the metric alert that + /// will be included in the alert email. /// the resource type of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. + /// resource(s) on which the alert is created/updated. Mandatory if the + /// scope contains a subscription, resource group, or more than one + /// resource. /// the region of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. + /// resource(s) on which the alert is created/updated. Mandatory if the + /// scope contains a subscription, resource group, or more than one + /// resource. /// the flag that indicates whether the /// alert should be auto resolved or not. The default is true. /// the array of actions that are performed when @@ -66,7 +68,9 @@ public MetricAlertResource() /// resolved. /// Last time the rule was updated in /// ISO8601 format. - public MetricAlertResource(string location, string description, int severity, bool enabled, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList scopes = default(IList), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + /// the value indicating whether this alert + /// rule is migrated. + public MetricAlertResource(string location, int severity, bool enabled, IList scopes, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), string isMigrated = default(string)) : base(location, id, name, type, tags) { Description = description; @@ -81,6 +85,7 @@ public MetricAlertResource() AutoMitigate = autoMitigate; Actions = actions; LastUpdatedTime = lastUpdatedTime; + IsMigrated = isMigrated; CustomInit(); } @@ -132,16 +137,16 @@ public MetricAlertResource() /// /// Gets or sets the resource type of the target resource(s) on which - /// the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. + /// the alert is created/updated. Mandatory if the scope contains a + /// subscription, resource group, or more than one resource. /// [JsonProperty(PropertyName = "properties.targetResourceType")] public string TargetResourceType { get; set; } /// /// Gets or sets the region of the target resource(s) on which the - /// alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. + /// alert is created/updated. Mandatory if the scope contains a + /// subscription, resource group, or more than one resource. /// [JsonProperty(PropertyName = "properties.targetResourceRegion")] public string TargetResourceRegion { get; set; } @@ -172,6 +177,12 @@ public MetricAlertResource() [JsonProperty(PropertyName = "properties.lastUpdatedTime")] public System.DateTime? LastUpdatedTime { get; private set; } + /// + /// Gets the value indicating whether this alert rule is migrated. + /// + [JsonProperty(PropertyName = "properties.isMigrated")] + public string IsMigrated { get; private set; } + /// /// Validate the object. /// @@ -181,9 +192,9 @@ public MetricAlertResource() public override void Validate() { base.Validate(); - if (Description == null) + if (Scopes == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + throw new ValidationException(ValidationRules.CannotBeNull, "Scopes"); } if (Criteria == null) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs index 7aaaa76ccfd9f..d2fd7e37a7372 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs @@ -34,27 +34,27 @@ public MetricAlertResourcePatch() /// /// Initializes a new instance of the MetricAlertResourcePatch class. /// + /// Resource tags /// the description of the metric alert that /// will be included in the alert email. /// Alert severity {0, 1, 2, 3, 4} /// the flag that indicates whether the metric /// alert is enabled. + /// the list of resource id's that this metric + /// alert is scoped to. /// how often the metric alert is /// evaluated represented in ISO 8601 duration format. /// the period of time (in ISO 8601 duration /// format) that is used to monitor alert activity based on the /// threshold. - /// defines the specific alert criteria - /// information. - /// Resource tags - /// the list of resource id's that this metric - /// alert is scoped to. /// the resource type of the target /// resource(s) on which the alert is created/updated. Mandatory for /// MultipleResourceMultipleMetricCriteria. /// the region of the target /// resource(s) on which the alert is created/updated. Mandatory for /// MultipleResourceMultipleMetricCriteria. + /// defines the specific alert criteria + /// information. /// the flag that indicates whether the /// alert should be auto resolved or not. The default is true. /// the array of actions that are performed when @@ -62,7 +62,9 @@ public MetricAlertResourcePatch() /// resolved. /// Last time the rule was updated in /// ISO8601 format. - public MetricAlertResourcePatch(string description, int severity, bool enabled, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, IDictionary tags = default(IDictionary), IList scopes = default(IList), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + /// the value indicating whether this alert + /// rule is migrated. + public MetricAlertResourcePatch(IDictionary tags = default(IDictionary), string description = default(string), int? severity = default(int?), bool? enabled = default(bool?), IList scopes = default(IList), System.TimeSpan? evaluationFrequency = default(System.TimeSpan?), System.TimeSpan? windowSize = default(System.TimeSpan?), string targetResourceType = default(string), string targetResourceRegion = default(string), MetricAlertCriteria criteria = default(MetricAlertCriteria), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), string isMigrated = default(string)) { Tags = tags; Description = description; @@ -77,6 +79,7 @@ public MetricAlertResourcePatch() AutoMitigate = autoMitigate; Actions = actions; LastUpdatedTime = lastUpdatedTime; + IsMigrated = isMigrated; CustomInit(); } @@ -102,14 +105,14 @@ public MetricAlertResourcePatch() /// Gets or sets alert severity {0, 1, 2, 3, 4} /// [JsonProperty(PropertyName = "properties.severity")] - public int Severity { get; set; } + public int? Severity { get; set; } /// /// Gets or sets the flag that indicates whether the metric alert is /// enabled. /// [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } + public bool? Enabled { get; set; } /// /// Gets or sets the list of resource id's that this metric alert is @@ -123,14 +126,14 @@ public MetricAlertResourcePatch() /// ISO 8601 duration format. /// [JsonProperty(PropertyName = "properties.evaluationFrequency")] - public System.TimeSpan EvaluationFrequency { get; set; } + public System.TimeSpan? EvaluationFrequency { get; set; } /// /// Gets or sets the period of time (in ISO 8601 duration format) that /// is used to monitor alert activity based on the threshold. /// [JsonProperty(PropertyName = "properties.windowSize")] - public System.TimeSpan WindowSize { get; set; } + public System.TimeSpan? WindowSize { get; set; } /// /// Gets or sets the resource type of the target resource(s) on which @@ -175,21 +178,10 @@ public MetricAlertResourcePatch() public System.DateTime? LastUpdatedTime { get; private set; } /// - /// Validate the object. + /// Gets the value indicating whether this alert rule is migrated. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - if (Criteria == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); - } - } + [JsonProperty(PropertyName = "properties.isMigrated")] + public string IsMigrated { get; private set; } + } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs index d595365129bcd..399811c3f81d6 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs @@ -35,8 +35,9 @@ public MetricCriteria() /// /// Name of the criteria. /// Name of the metric. - /// the criteria time aggregation - /// types. + /// the criteria time aggregation types. + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' /// the criteria operator. Possible /// values include: 'Equals', 'NotEquals', 'GreaterThan', /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' @@ -49,7 +50,7 @@ public MetricCriteria() /// Allows creating an alert rule on /// a custom metric that isn't yet emitted, by causing the metric /// validation to be skipped. - public MetricCriteria(string name, string metricName, object timeAggregation, string operatorProperty, double threshold, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) + public MetricCriteria(string name, string metricName, string timeAggregation, string operatorProperty, double threshold, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) { OperatorProperty = operatorProperty; diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs index f83400684fce2..c94de154af846 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs @@ -34,8 +34,9 @@ public MultiMetricCriteria() /// /// Name of the criteria. /// Name of the metric. - /// the criteria time aggregation - /// types. + /// the criteria time aggregation types. + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' /// Unmatched properties from the /// message are deserialized this collection /// Namespace of the metric. @@ -43,7 +44,7 @@ public MultiMetricCriteria() /// Allows creating an alert rule on /// a custom metric that isn't yet emitted, by causing the metric /// validation to be skipped. - public MultiMetricCriteria(string name, string metricName, object timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) + public MultiMetricCriteria(string name, string metricName, string timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) { AdditionalProperties = additionalProperties; Name = name; @@ -86,10 +87,11 @@ public MultiMetricCriteria() public string MetricNamespace { get; set; } /// - /// Gets or sets the criteria time aggregation types. + /// Gets or sets the criteria time aggregation types. Possible values + /// include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' /// [JsonProperty(PropertyName = "timeAggregation")] - public object TimeAggregation { get; set; } + public string TimeAggregation { get; set; } /// /// Gets or sets list of dimension conditions. diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs deleted file mode 100644 index 083acf9836947..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The status of operation. - /// - public partial class OperationStatus - { - /// - /// Initializes a new instance of the OperationStatus class. - /// - public OperationStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatus class. - /// - /// The operation Id. - /// The operation name. - /// Start time of the job in standard ISO8601 - /// format. - /// End time of the job in standard ISO8601 - /// format. - /// The status of the operation. - /// The error detail of the operation if - /// any. - public OperationStatus(string id = default(string), string name = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string status = default(string), ErrorResponseCommon error = default(ErrorResponseCommon)) - { - Id = id; - Name = name; - StartTime = startTime; - EndTime = endTime; - Status = status; - Error = error; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operation Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the operation name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets start time of the job in standard ISO8601 format. - /// - [JsonProperty(PropertyName = "startTime")] - public System.DateTime? StartTime { get; set; } - - /// - /// Gets or sets end time of the job in standard ISO8601 format. - /// - [JsonProperty(PropertyName = "endTime")] - public System.DateTime? EndTime { get; set; } - - /// - /// Gets or sets the status of the operation. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the error detail of the operation if any. - /// - [JsonProperty(PropertyName = "error")] - public ErrorResponseCommon Error { get; set; } - - } -} 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 deleted file mode 100644 index 6d519443ccec2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of 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/PrivateEndpointConnection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs deleted file mode 100644 index 92815fd0af437..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private endpoint connection - /// - [Rest.Serialization.JsonTransformation] - public partial class PrivateEndpointConnection : ProxyResource - { - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - public PrivateEndpointConnection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Private endpoint which the connection - /// belongs to. - /// Connection state of - /// the private endpoint connection. - /// State of the private endpoint - /// connection. - public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) - : base(id, name, type) - { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets private endpoint which the connection belongs to. - /// - [JsonProperty(PropertyName = "properties.privateEndpoint")] - public PrivateEndpointProperty PrivateEndpoint { get; set; } - - /// - /// Gets or sets connection state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] - public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } - - /// - /// Gets state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PrivateLinkServiceConnectionState != null) - { - PrivateLinkServiceConnectionState.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs deleted file mode 100644 index 58ffe77bb549d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Private endpoint which the connection belongs to. - /// - public partial class PrivateEndpointProperty - { - /// - /// Initializes a new instance of the PrivateEndpointProperty class. - /// - public PrivateEndpointProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateEndpointProperty class. - /// - /// Resource id of the private endpoint. - public PrivateEndpointProperty(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource id of the private endpoint. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs deleted file mode 100644 index 7c2dae65de48f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A private link resource - /// - [Rest.Serialization.JsonTransformation] - public partial class PrivateLinkResource : ProxyResource - { - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - public PrivateLinkResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The private link resource group id. - /// The private link resource required - /// member names. - public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList)) - : base(id, name, type) - { - GroupId = groupId; - RequiredMembers = requiredMembers; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the private link resource group id. - /// - [JsonProperty(PropertyName = "properties.groupId")] - public string GroupId { get; private set; } - - /// - /// Gets the private link resource required member names. - /// - [JsonProperty(PropertyName = "properties.requiredMembers")] - public IList RequiredMembers { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs deleted file mode 100644 index ef895d3807606..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An azure resource object - /// - public partial class PrivateLinkScopesResource : IResource - { - /// - /// Initializes a new instance of the PrivateLinkScopesResource class. - /// - public PrivateLinkScopesResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkScopesResource class. - /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - public PrivateLinkScopesResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) - { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets azure resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets azure resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets resource location - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs deleted file mode 100644 index 887acba7f23a4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// State of the private endpoint connection. - /// - public partial class PrivateLinkServiceConnectionStateProperty - { - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - public PrivateLinkServiceConnectionStateProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - /// The private link service connection - /// status. - /// The private link service connection - /// description. - /// The actions required for private link - /// service connection. - public PrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired = default(string)) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the private link service connection status. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the private link service connection description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets the actions required for private link service connection. - /// - [JsonProperty(PropertyName = "actionsRequired")] - public string ActionsRequired { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - } - } -} 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 deleted file mode 100644 index 5c42e64be82b1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using 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/ScopedResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs deleted file mode 100644 index bbfe8c1a2fad9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private link scoped resource - /// - [Rest.Serialization.JsonTransformation] - public partial class ScopedResource : ProxyResource - { - /// - /// Initializes a new instance of the ScopedResource class. - /// - public ScopedResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScopedResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The resource id of the scoped Azure - /// monitor resource. - /// State of the private endpoint - /// connection. - public ScopedResource(string id = default(string), string name = default(string), string type = default(string), string linkedResourceId = default(string), string provisioningState = default(string)) - : base(id, name, type) - { - LinkedResourceId = linkedResourceId; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource id of the scoped Azure monitor resource. - /// - [JsonProperty(PropertyName = "properties.linkedResourceId")] - public string LinkedResourceId { get; set; } - - /// - /// Gets state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private 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 deleted file mode 100644 index f3106d2c8e3df..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of 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/TagsResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs deleted file mode 100644 index 3dc9207c30c3f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A container holding only the Tags for a resource, allowing the user to - /// update the tags on a PrivateLinkScope instance. - /// - public partial class TagsResource - { - /// - /// Initializes a new instance of the TagsResource class. - /// - public TagsResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TagsResource class. - /// - /// Resource tags - public TagsResource(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/TimeSeriesBaseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs index 24a82423f3121..931c37ed34052 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs @@ -40,14 +40,14 @@ public TimeSeriesBaseline() /// sensitivity. /// The dimensions of this time /// series. - /// The baseline metadata values. - public TimeSeriesBaseline(string aggregation, IList timestamps, IList data, IList dimensions = default(IList), IList metadata = default(IList)) + /// The baseline metadata values. + public TimeSeriesBaseline(string aggregation, IList timestamps, IList data, IList dimensions = default(IList), IList metadataValues = default(IList)) { Aggregation = aggregation; Dimensions = dimensions; Timestamps = timestamps; Data = data; - Metadata = metadata; + MetadataValues = metadataValues; CustomInit(); } @@ -83,8 +83,8 @@ public TimeSeriesBaseline() /// /// Gets or sets the baseline metadata values. /// - [JsonProperty(PropertyName = "metadata")] - public IList Metadata { get; set; } + [JsonProperty(PropertyName = "metadataValues")] + public IList MetadataValues { get; set; } /// /// Validate the object. @@ -126,9 +126,9 @@ public virtual void Validate() } } } - if (Metadata != null) + if (MetadataValues != null) { - foreach (var element2 in Metadata) + foreach (var element2 in MetadataValues) { if (element2 != null) { 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 deleted file mode 100644 index 61f6f218370f7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of 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 aedbcd71c6ab5..c1e39b95702f4 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs @@ -47,7 +47,7 @@ public partial class MonitorManagementClient : ServiceClient - /// The Azure subscription Id. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } @@ -174,42 +174,6 @@ public partial class MonitorManagementClient : ServiceClient public virtual IVMInsightsOperations VMInsights { get; private set; } - /// - /// Gets the IPrivateLinkScopesOperations. - /// - public virtual IPrivateLinkScopesOperations PrivateLinkScopes { get; private set; } - - /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. - /// - public virtual IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; private set; } - - /// - /// Gets the IPrivateLinkResourcesOperations. - /// - public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } - - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } - - /// - /// Gets the IPrivateLinkScopedResourcesOperations. - /// - 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. /// @@ -472,13 +436,6 @@ private void Initialize() ScheduledQueryRules = new ScheduledQueryRulesOperations(this); MetricNamespaces = new MetricNamespacesOperations(this); VMInsights = new VMInsightsOperations(this); - PrivateLinkScopes = new PrivateLinkScopesOperations(this); - PrivateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusOperations(this); - 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/PrivateEndpointConnectionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs deleted file mode 100644 index b7707970f58d2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,1078 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations - { - /// - /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// 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 scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - 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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", 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/privateLinkScopes/{scopeName}/privateEndpointConnections").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs deleted file mode 100644 index d07f38630a449..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ /dev/null @@ -1,331 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateEndpointConnectionsOperations. - /// - public static partial class PrivateEndpointConnectionsOperationsExtensions - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - return operations.GetAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - operations.DeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static void BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs deleted file mode 100644 index 62700162013ce..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,627 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkResourcesOperations operations. - /// - internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations - { - /// - /// Initializes a new instance of the PrivateLinkResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkResourcesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", 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/privateLinkScopes/{scopeName}/privateLinkResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link 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> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("groupName", groupName); - 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/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs deleted file mode 100644 index dafb85e58f418..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ /dev/null @@ -1,151 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkResourcesOperations. - /// - public static partial class PrivateLinkResourcesOperationsExtensions - { - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link resource. - /// - public static PrivateLinkResource Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, string groupName) - { - return operations.GetAsync(resourceGroupName, scopeName, groupName).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, groupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateLinkResourcesOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs deleted file mode 100644 index 9fdbfc3bdff8a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs +++ /dev/null @@ -1,249 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopeOperationStatusOperations operations. - /// - internal partial class PrivateLinkScopeOperationStatusOperations : IServiceOperations, IPrivateLinkScopeOperationStatusOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopeOperationStatusOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (asyncOperationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "asyncOperationId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("asyncOperationId", asyncOperationId); - tracingParameters.Add("resourceGroupName", resourceGroupName); - 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/privateLinkScopeOperationStatuses/{asyncOperationId}").ToString(); - _url = _url.Replace("{asyncOperationId}", System.Uri.EscapeDataString(asyncOperationId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs deleted file mode 100644 index e462cde5e7b67..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopeOperationStatusOperations. - /// - public static partial class PrivateLinkScopeOperationStatusOperationsExtensions - { - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - public static OperationStatus Get(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName) - { - return operations.GetAsync(asyncOperationId, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(asyncOperationId, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs deleted file mode 100644 index d95c8489f5dce..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs +++ /dev/null @@ -1,1095 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopedResourcesOperations operations. - /// - internal partial class PrivateLinkScopedResourcesOperations : IServiceOperations, IPrivateLinkScopedResourcesOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopedResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// 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 scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("name", name); - 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/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", 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/privateLinkScopes/{scopeName}/scopedResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-preview"; - ScopedResource parameters = new ScopedResource(); - if (linkedResourceId != null) - { - parameters.LinkedResourceId = linkedResourceId; - } - // 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("scopeName", scopeName); - tracingParameters.Add("name", name); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs deleted file mode 100644 index 3347d287b5359..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs +++ /dev/null @@ -1,335 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopedResourcesOperations. - /// - public static partial class PrivateLinkScopedResourcesOperationsExtensions - { - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static ScopedResource Get(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - return operations.GetAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - public static ScopedResource CreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static void Delete(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - operations.DeleteAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - public static ScopedResource BeginCreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static void BeginDelete(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs deleted file mode 100644 index 31ebf39a4d7b9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs +++ /dev/null @@ -1,1593 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopesOperations operations. - /// - internal partial class PrivateLinkScopesOperations : IServiceOperations, IPrivateLinkScopesOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-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, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-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/privateLinkScopes").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - 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/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (azureMonitorPrivateLinkScopePayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "azureMonitorPrivateLinkScopePayload"); - } - if (azureMonitorPrivateLinkScopePayload != null) - { - azureMonitorPrivateLinkScopePayload.Validate(); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("azureMonitorPrivateLinkScopePayload", azureMonitorPrivateLinkScopePayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(azureMonitorPrivateLinkScopePayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(azureMonitorPrivateLinkScopePayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - TagsResource privateLinkScopeTags = new TagsResource(); - if (tags != null) - { - privateLinkScopeTags.Tags = tags; - } - // 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("scopeName", scopeName); - tracingParameters.Add("privateLinkScopeTags", privateLinkScopeTags); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(privateLinkScopeTags != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateLinkScopeTags, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-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("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs deleted file mode 100644 index 9ef341324e7c8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs +++ /dev/null @@ -1,371 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopesOperations. - /// - public static partial class PrivateLinkScopesOperationsExtensions - { - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IPrivateLinkScopesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IPrivateLinkScopesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IPage ListByResourceGroup(this IPrivateLinkScopesOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static void Delete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - operations.DeleteAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static AzureMonitorPrivateLinkScope Get(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - return operations.GetAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - public static AzureMonitorPrivateLinkScope CreateOrUpdate(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload).GetAwaiter().GetResult(); - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - public static AzureMonitorPrivateLinkScope UpdateTags(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary)) - { - return operations.UpdateTagsAsync(resourceGroupName, scopeName, tags).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// The cancellation token. - /// - public static async Task UpdateTagsAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, scopeName, tags, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static void BeginDelete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IPrivateLinkScopesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IPrivateLinkScopesOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs index 7f8e047880016..63a59f6257d73 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs @@ -90,6 +90,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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"); @@ -320,6 +327,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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 = "2018-04-16"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -504,6 +518,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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"); @@ -709,6 +730,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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 = "2018-04-16"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -869,6 +897,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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 = "2018-04-16"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1059,6 +1094,13 @@ internal ScheduledQueryRulesOperations(MonitorManagementClient client) { 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 = "2018-04-16"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; 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 25d90d1590b2e..1f56d496a12af 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,21 +19,17 @@ 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", "AlertRules", "2016-03-01"), + new Tuple("Insights", "Baselines", "2019-03-01"), new Tuple("Insights", "MetricAlerts", "2018-03-01"), new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), - new Tuple("Insights", "PrivateEndpointConnections", "2019-10-17-preview"), - new Tuple("Insights", "PrivateLinkResources", "2019-10-17-preview"), - new Tuple("Insights", "PrivateLinkScopedResources", "2019-10-17-preview"), + new Tuple("Insights", "MetricBaseline", "2017-11-01-preview"), new Tuple("Insights", "VMInsights", "2018-11-27-preview"), new Tuple("insights", "ActionGroups", "2019-06-01"), new Tuple("insights", "ActivityLogAlerts", "2017-04-01"), new Tuple("insights", "ActivityLogs", "2015-04-01"), new Tuple("insights", "AlertRuleIncidents", "2016-03-01"), - new Tuple("insights", "AlertRules", "2016-03-01"), new Tuple("insights", "AutoscaleSettings", "2015-04-01"), - new Tuple("insights", "Baselines", "2019-03-01"), new Tuple("insights", "DiagnosticSettings", "2017-05-01-preview"), new Tuple("insights", "DiagnosticSettingsCategory", "2017-05-01-preview"), new Tuple("insights", "EventCategories", "2015-04-01"), @@ -43,23 +39,10 @@ public static IEnumerable> ApiInfo_MonitorClient new Tuple("insights", "MetricNamespaces", "2017-12-01-preview"), new Tuple("insights", "Metrics", "2018-01-01"), new Tuple("insights", "Operations", "2015-04-01"), - new Tuple("insights", "PrivateLinkScopeOperationStatus", "2019-10-17-preview"), - new Tuple("insights", "PrivateLinkScopes", "2019-10-17-preview"), new Tuple("insights", "ScheduledQueryRules", "2018-04-16"), new Tuple("insights", "TenantActivityLogs", "2015-04-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/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 = "27cc07ddd294d98e05cb301e07a72378df9f87e8"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -