From 497703b6bed0b2a47b7379f3d470713a925fb5d8 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:24:58 +0800 Subject: [PATCH 1/8] generate autorest csharp --- .../Generated/ActivityLogsOperations.cs | 431 +++++ .../ActivityLogsOperationsExtensions.cs | 112 ++ .../Generated/AlertRulesOperations.cs | 1306 +++++++++++++ .../AlertRulesOperationsExtensions.cs | 260 +++ .../Generated/AutoscaleSettingsOperations.cs | 1624 ++++++++++++++++ .../AutoscaleSettingsOperationsExtensions.cs | 326 ++++ .../Generated/BaselinesOperations.cs | 310 +++ .../BaselinesOperationsExtensions.cs | 143 ++ .../Generated/DiagnosticSettingsOperations.cs | 774 ++++++++ .../DiagnosticSettingsOperationsExtensions.cs | 182 ++ .../Generated/EventCategoriesOperations.cs | 216 +++ .../EventCategoriesOperationsExtensions.cs | 59 + .../Generated/IActivityLogsOperations.cs | 82 + .../Generated/IAlertRulesOperations.cs | 172 ++ .../Generated/IAutoscaleSettingsOperations.cs | 216 +++ .../Generated/IBaselinesOperations.cs | 93 + .../IDiagnosticSettingsOperations.cs | 125 ++ .../Generated/IEventCategoriesOperations.cs | 49 + .../Generated/ILogProfilesOperations.cs | 138 ++ .../Generated/IMetricAlertsOperations.cs | 171 ++ .../IMetricAlertsStatusOperations.cs | 80 + .../Generated/IMetricDefinitionsOperations.cs | 52 + .../Generated/IMetricNamespacesOperations.cs | 53 + .../Generated/IMetricsOperations.cs | 87 + .../Generated/IMonitorManagementClient.cs | 153 ++ .../IPrivateEndpointConnectionsOperations.cs | 212 +++ .../IPrivateLinkResourcesOperations.cs | 105 + ...ivateLinkScopeOperationStatusOperations.cs | 53 + .../IPrivateLinkScopedResourcesOperations.cs | 214 +++ .../Generated/IPrivateLinkScopesOperations.cs | 245 +++ .../Generated/LogProfilesOperations.cs | 1007 ++++++++++ .../LogProfilesOperationsExtensions.cs | 202 ++ .../Generated/MetricAlertsOperations.cs | 1269 +++++++++++++ .../MetricAlertsOperationsExtensions.cs | 258 +++ .../Generated/MetricAlertsStatusOperations.cs | 477 +++++ .../MetricAlertsStatusOperationsExtensions.cs | 111 ++ .../Generated/MetricDefinitionsOperations.cs | 237 +++ .../MetricDefinitionsOperationsExtensions.cs | 67 + .../Generated/MetricNamespacesOperations.cs | 238 +++ .../MetricNamespacesOperationsExtensions.cs | 69 + .../Generated/MetricsOperations.cs | 315 +++ .../Generated/MetricsOperationsExtensions.cs | 132 ++ .../Generated/Models/AggregationType.cs | 84 + .../Generated/Models/AggregationTypeEnum.cs | 25 + .../Generated/Models/AlertRuleResource.cs | 149 ++ .../Models/AlertRuleResourcePatch.cs | 149 ++ .../Generated/Models/AutoscaleNotification.cs | 76 + .../Generated/Models/AutoscaleProfile.cs | 140 ++ .../Models/AutoscaleSettingResource.cs | 143 ++ .../Models/AutoscaleSettingResourcePatch.cs | 145 ++ .../Models/AzureMonitorPrivateLinkScope.cs | 100 + .../Generated/Models/BaselineMetadata.cs | 77 + .../Generated/Models/BaselineSensitivity.cs | 23 + .../Models/ComparisonOperationType.cs | 84 + .../Generated/Models/ConditionOperator.cs | 72 + .../Models/DiagnosticSettingsResource.cs | 139 ++ .../DiagnosticSettingsResourceCollection.cs | 56 + .../Generated/Models/DynamicMetricCriteria.cs | 134 ++ .../Models/DynamicThresholdFailingPeriods.cs | 80 + .../Models/DynamicThresholdOperator.cs | 23 + .../Models/DynamicThresholdSensitivity.cs | 23 + .../Generated/Models/EmailNotification.cs | 76 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../Generated/Models/ErrorResponse.cs | 60 + .../Generated/Models/ErrorResponseCommon.cs | 65 + .../Models/ErrorResponseCommonException.cs | 62 + .../Models/ErrorResponseException.cs | 62 + .../Generated/Models/EventData.cs | 339 ++++ .../Generated/Models/EventLevel.cs | 78 + .../Generated/Models/HttpRequestInfo.cs | 75 + .../Generated/Models/LocalizableString.cs | 73 + .../Models/LocationThresholdRuleCondition.cs | 87 + .../Generated/Models/LogProfileResource.cs | 138 ++ .../Models/LogProfileResourcePatch.cs | 139 ++ .../Generated/Models/LogSettings.cs | 89 + .../ManagementEventAggregationCondition.cs | 78 + .../Models/ManagementEventRuleCondition.cs | 64 + .../Generated/Models/MetadataValue.cs | 72 + .../Generated/Models/Metric.cs | 159 ++ .../Generated/Models/MetricAlertAction.cs | 66 + .../Generated/Models/MetricAlertCriteria.cs | 56 + ...tMultipleResourceMultipleMetricCriteria.cs | 62 + .../Generated/Models/MetricAlertResource.cs | 205 ++ .../Models/MetricAlertResourcePatch.cs | 187 ++ ...ertSingleResourceMultipleMetricCriteria.cs | 62 + .../Generated/Models/MetricAlertStatus.cs | 77 + .../Models/MetricAlertStatusCollection.cs | 56 + .../Models/MetricAlertStatusProperties.cs | 73 + .../Generated/Models/MetricAvailability.cs | 66 + .../Generated/Models/MetricClass.cs | 25 + .../Generated/Models/MetricCriteria.cs | 95 + .../Generated/Models/MetricDefinition.cs | 201 ++ .../Generated/Models/MetricDimension.cs | 93 + .../Generated/Models/MetricNamespace.cs | 87 + .../Generated/Models/MetricNamespaceName.cs | 52 + .../Generated/Models/MetricSettings.cs | 98 + .../Generated/Models/MetricSingleDimension.cs | 77 + .../Generated/Models/MetricStatisticType.cs | 78 + .../Generated/Models/MetricTrigger.cs | 208 ++ .../Generated/Models/MetricUnit.cs | 33 + .../Generated/Models/MetricValue.cs | 107 ++ .../Generated/Models/MultiMetricCriteria.cs | 142 ++ .../Models/NamespaceClassification.cs | 23 + .../Generated/Models/OperationStatus.cs | 94 + .../Generated/Models/OperatorModel.cs | 25 + .../Generated/Models/Page.cs | 53 + .../Generated/Models/Page1.cs | 53 + .../Models/PrivateEndpointConnection.cs | 90 + .../Models/PrivateEndpointProperty.cs | 51 + .../Generated/Models/PrivateLinkResource.cs | 69 + .../Models/PrivateLinkScopesResource.cs | 100 + ...ivateLinkServiceConnectionStateProperty.cs | 90 + .../Generated/Models/ProxyOnlyResource.cs | 69 + .../Generated/Models/ProxyResource.cs | 69 + .../Generated/Models/Recurrence.cs | 92 + .../Generated/Models/RecurrenceFrequency.cs | 96 + .../Generated/Models/RecurrentSchedule.cs | 194 ++ .../Generated/Models/Resource.cs | 100 + .../Generated/Models/Response.cs | 144 ++ .../Generated/Models/ResultType.cs | 60 + .../Generated/Models/RetentionPolicy.cs | 77 + .../Generated/Models/RuleAction.cs | 38 + .../Generated/Models/RuleCondition.cs | 56 + .../Generated/Models/RuleDataSource.cs | 85 + .../Generated/Models/RuleEmailAction.cs | 69 + .../RuleManagementEventClaimsDataSource.cs | 53 + .../Models/RuleManagementEventDataSource.cs | 136 ++ .../Generated/Models/RuleMetricDataSource.cs | 65 + .../Generated/Models/RuleWebhookAction.cs | 68 + .../Generated/Models/ScaleAction.cs | 101 + .../Generated/Models/ScaleCapacity.cs | 99 + .../Generated/Models/ScaleDirection.cs | 66 + .../Generated/Models/ScaleRule.cs | 87 + .../Models/ScaleRuleMetricDimension.cs | 99 + .../ScaleRuleMetricDimensionOperationType.cs | 22 + .../Generated/Models/ScaleType.cs | 72 + .../Generated/Models/ScopedResource.cs | 68 + .../Generated/Models/SenderAuthorization.cs | 72 + .../Generated/Models/SingleBaseline.cs | 95 + .../Generated/Models/SingleMetricBaseline.cs | 160 ++ .../Generated/Models/TagsResource.cs | 54 + .../Models/ThresholdRuleCondition.cs | 106 ++ .../Models/TimeAggregationOperator.cs | 78 + .../Generated/Models/TimeAggregationType.cs | 84 + .../Generated/Models/TimeSeriesBaseline.cs | 141 ++ .../Generated/Models/TimeSeriesElement.cs | 68 + .../Generated/Models/TimeWindow.cs | 162 ++ .../Generated/Models/WebhookNotification.cs | 63 + .../WebtestLocationAvailabilityCriteria.cs | 96 + .../Generated/MonitorManagementClient.cs | 460 +++++ .../PrivateEndpointConnectionsOperations.cs | 1150 +++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 331 ++++ .../PrivateLinkResourcesOperations.cs | 663 +++++++ ...rivateLinkResourcesOperationsExtensions.cs | 151 ++ ...ivateLinkScopeOperationStatusOperations.cs | 267 +++ ...copeOperationStatusOperationsExtensions.cs | 67 + .../PrivateLinkScopedResourcesOperations.cs | 1167 ++++++++++++ ...LinkScopedResourcesOperationsExtensions.cs | 335 ++++ .../Generated/PrivateLinkScopesOperations.cs | 1690 +++++++++++++++++ .../PrivateLinkScopesOperationsExtensions.cs | 371 ++++ .../SdkInfo_MonitorManagementClient.cs | 43 + .../Monitor.Management.Sdk.csproj | 13 + .../Properties/AssemblyInfo.cs | 29 + src/Monitor/Monitor.Management.Sdk/README.md | 123 ++ src/Monitor/Monitor.Test/Monitor.Test.csproj | 2 +- src/Monitor/Monitor.sln | 58 +- src/Monitor/Monitor/Az.Monitor.psd1 | 2 +- src/Monitor/Monitor/Monitor.csproj | 6 +- .../OutputClasses/PSActionGroupProperty.cs | 116 -- .../OutputClasses/PSActionGroupResource.cs | 150 -- .../PSAddActionGroupOperationResponse.cs | 25 - .../OutputClasses/PSArmRoleReceiver.cs | 46 - .../PSAutomationRunbookReceiver.cs | 62 - .../OutputClasses/PSAutoscaleProfilesList.cs | 37 - .../OutputClasses/PSAutoscaleSetting.cs | 39 - .../PSAutoscaleSettingNoDetails.cs | 33 - .../OutputClasses/PSAzureAppPushReceiver.cs | 45 - .../OutputClasses/PSAzureFunctionReceiver.cs | 60 - .../PSDataCollectionRuleResource.cs | 658 ------- .../PSDiagnosticSettingCategory.cs | 39 - .../PSDiagnosticSettingOperationResponse.cs | 29 - .../Monitor/OutputClasses/PSEmailReceiver.cs | 57 - .../OutputClasses/PSEventHubReceiver.cs | 61 - .../Monitor/OutputClasses/PSItsmReceiver.cs | 55 - .../OutputClasses/PSLogicAppReceiver.cs | 54 - .../Monitor/OutputClasses/PSMetricSettings.cs | 73 - .../PSScheduledQueryRuleAlertingAction.cs | 26 - .../PSScheduledQueryRuleAznsAction.cs | 25 - .../PSScheduledQueryRuleLogMetricTrigger.cs | 29 - .../PSScheduledQueryRuleResource.cs | 25 - .../PSScheduledQueryRuleSchedule.cs | 25 - .../PSScheduledQueryRuleSource.cs | 25 - .../PSScheduledQueryRuleTriggerCondition.cs | 25 - .../PSServiceDiagnosticSettings.cs | 86 - .../Monitor/OutputClasses/PSSmsReceiver.cs | 56 - .../PSTestNotificationDetailsResponse.cs | 56 - .../PSTestNotificationResource.cs | 141 -- .../OutputClasses/PSThresholdRuleCondition.cs | 80 - .../Monitor/OutputClasses/PSVoiceReceiver.cs | 47 - .../OutputClasses/PSWebhookReceiver.cs | 74 - .../TransitionalClasses/MetricSettings.cs | 53 - .../ScheduledQueryRuleAlertingAction.cs | 34 - .../ScheduledQueryRuleAznsAction.cs | 33 - .../ScheduledQueryRuleMetricTrigger.cs | 34 - .../ScheduledQueryRuleResource.cs | 42 - .../ScheduledQueryRuleSchedule.cs | 32 - .../ScheduledQueryRuleSource.cs | 38 - .../ScheduledQueryRuleTriggerCondition.cs | 33 - .../TransitionalClasses/TransitionHelpers.cs | 22 - 209 files changed, 28937 insertions(+), 2711 deletions(-) create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Monitor.Management.Sdk.csproj create mode 100644 src/Monitor/Monitor.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/README.md delete mode 100644 src/Monitor/Monitor/OutputClasses/PSActionGroupProperty.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSActionGroupResource.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAddActionGroupOperationResponse.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSArmRoleReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAutomationRunbookReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAutoscaleProfilesList.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAutoscaleSetting.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAutoscaleSettingNoDetails.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAzureAppPushReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSAzureFunctionReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSDataCollectionRuleResource.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingOperationResponse.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSEmailReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSEventHubReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSItsmReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSLogicAppReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAlertingAction.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAznsAction.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleLogMetricTrigger.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleResource.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSchedule.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSource.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleTriggerCondition.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSSmsReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSTestNotificationDetailsResponse.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSTestNotificationResource.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSThresholdRuleCondition.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSVoiceReceiver.cs delete mode 100644 src/Monitor/Monitor/OutputClasses/PSWebhookReceiver.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/MetricSettings.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAlertingAction.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAznsAction.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleMetricTrigger.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleResource.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSchedule.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSource.cs delete mode 100644 src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleTriggerCondition.cs diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs new file mode 100644 index 000000000000..8e4f078e958a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs @@ -0,0 +1,431 @@ +// +// 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 Microsoft.Rest.Azure.OData; + 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; + + /// + /// ActivityLogsOperations operations. + /// + internal partial class ActivityLogsOperations : IServiceOperations, IActivityLogsOperations + { + /// + /// Initializes a new instance of the ActivityLogsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ActivityLogsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Used to fetch events with only the given properties.<br>The + /// **$select** argument is a comma separated list of property names to be + /// returned. Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* + /// + /// + /// 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(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (odataQuery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "odataQuery"); + } + 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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("select", select); + 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/eventtypes/management/values").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs new file mode 100644 index 000000000000..ed039c9d08e2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs @@ -0,0 +1,112 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ActivityLogsOperations. + /// + public static partial class ActivityLogsOperationsExtensions + { + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Used to fetch events with only the given properties.<br>The + /// **$select** argument is a comma separated list of property names to be + /// returned. Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* + /// + public static IPage List(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string)) + { + return operations.ListAsync(odataQuery, select).GetAwaiter().GetResult(); + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Used to fetch events with only the given properties.<br>The + /// **$select** argument is a comma separated list of property names to be + /// returned. Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, select, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IActivityLogsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// 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 IActivityLogsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs new file mode 100644 index 000000000000..f9008268502c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs @@ -0,0 +1,1306 @@ +// +// 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; + + /// + /// AlertRulesOperations operations. + /// + internal partial class AlertRulesOperations : IServiceOperations, IAlertRulesOperations + { + /// + /// Initializes a new instance of the AlertRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AlertRulesOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + 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/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)); + 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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a classic metric alert rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/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)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a classic metric alert rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/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)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (alertRulesResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "alertRulesResource"); + } + string apiVersion = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("alertRulesResource", alertRulesResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(alertRulesResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertRulesResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the classic metric alert rules within a 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 (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 (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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("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/alertrules").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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the classic metric alert rules 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>> 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/alertrules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs new file mode 100644 index 000000000000..a803ec871d91 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs @@ -0,0 +1,260 @@ +// +// 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 AlertRulesOperations. + /// + public static partial class AlertRulesOperationsExtensions + { + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + public static AlertRuleResource CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) + { + operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static AlertRuleResource Get(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) + { + return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Gets a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// Parameters supplied to the operation. + /// + public static AlertRuleResource Update(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource) + { + return operations.UpdateAsync(resourceGroupName, ruleName, alertRulesResource).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, alertRulesResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the classic metric alert rules within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListByResourceGroup(this IAlertRulesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List the classic metric alert rules within a 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 IAlertRulesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListBySubscription(this IAlertRulesOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IAlertRulesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs new file mode 100644 index 000000000000..95b19aa4b48d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs @@ -0,0 +1,1624 @@ +// +// 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; + + /// + /// AutoscaleSettingsOperations operations. + /// + internal partial class AutoscaleSettingsOperations : IServiceOperations, IAutoscaleSettingsOperations + { + /// + /// Initializes a new instance of the AutoscaleSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AutoscaleSettingsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Lists the autoscale settings for a 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 (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 (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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("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/autoscalesettings").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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (autoscaleSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + 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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes and autoscale setting + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// 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 autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (autoscaleSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + } + 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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/autoscalesettings/{autoscaleSettingName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an autoscale setting + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// 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 autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (autoscaleSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + } + 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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/autoscalesettings/{autoscaleSettingName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (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 (autoscaleSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + } + if (autoscaleSettingResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingResource"); + } + string apiVersion = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("autoscaleSettingResource", autoscaleSettingResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(autoscaleSettingResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(autoscaleSettingResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the autoscale settings for a 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 = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/autoscalesettings").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the autoscale settings for 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the autoscale settings for a 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..e43d0fda5f27 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs @@ -0,0 +1,326 @@ +// +// 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 AutoscaleSettingsOperations. + /// + public static partial class AutoscaleSettingsOperationsExtensions + { + /// + /// Lists the autoscale settings for a resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IAutoscaleSettingsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists the autoscale settings for a 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 IAutoscaleSettingsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + public static AutoscaleSettingResource CreateOrUpdate(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes and autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static void Delete(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) + { + operations.DeleteAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); + } + + /// + /// Deletes and autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static AutoscaleSettingResource Get(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) + { + return operations.GetAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); + } + + /// + /// Gets an autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + public static AutoscaleSettingResource Update(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) + { + return operations.UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IAutoscaleSettingsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IAutoscaleSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the autoscale settings for 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 IAutoscaleSettingsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the autoscale settings for 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 IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IAutoscaleSettingsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the autoscale settings for 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> ListBySubscriptionNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs new file mode 100644 index 000000000000..36834d87f796 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs @@ -0,0 +1,310 @@ +// +// 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; + + /// + /// BaselinesOperations operations. + /// + internal partial class BaselinesOperations : IServiceOperations, IBaselinesOperations + { + /// + /// Initializes a new instance of the BaselinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BaselinesOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. Possible values include: 'Data', 'Metadata' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2019-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceUri", resourceUri); + tracingParameters.Add("metricnames", metricnames); + tracingParameters.Add("metricnamespace", metricnamespace); + tracingParameters.Add("timespan", timespan); + tracingParameters.Add("interval", interval); + tracingParameters.Add("aggregation", aggregation); + tracingParameters.Add("sensitivities", sensitivities); + tracingParameters.Add("filter", filter); + tracingParameters.Add("resultType", resultType); + 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("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metricBaselines").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + List _queryParameters = new List(); + if (metricnames != null) + { + _queryParameters.Add(string.Format("metricnames={0}", System.Uri.EscapeDataString(metricnames))); + } + if (metricnamespace != null) + { + _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); + } + if (timespan != null) + { + _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); + } + if (interval != null) + { + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); + } + if (aggregation != null) + { + _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(aggregation))); + } + if (sensitivities != null) + { + _queryParameters.Add(string.Format("sensitivities={0}", System.Uri.EscapeDataString(sensitivities))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (resultType != null) + { + _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs new file mode 100644 index 000000000000..3fa0170b488f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs @@ -0,0 +1,143 @@ +// +// 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 BaselinesOperations. + /// + public static partial class BaselinesOperationsExtensions + { + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. Possible values include: 'Data', 'Metadata' + /// + public static IEnumerable List(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?)) + { + return operations.ListAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).GetAwaiter().GetResult(); + } + + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. Possible values include: 'Data', 'Metadata' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs new file mode 100644 index 000000000000..91eb2f4aa820 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs @@ -0,0 +1,774 @@ +// +// 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; + + /// + /// DiagnosticSettingsOperations operations. + /// + internal partial class DiagnosticSettingsOperations : IServiceOperations, IDiagnosticSettingsOperations + { + /// + /// Initializes a new instance of the DiagnosticSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiagnosticSettingsOperations(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 active diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + string apiVersion = "2017-05-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("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("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + string apiVersion = "2017-05-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("parameters", parameters); + tracingParameters.Add("name", name); + 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("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + string apiVersion = "2017-05-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("name", name); + 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/diagnosticSettings/{name}").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + _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 != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the active diagnostic settings list 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> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2017-05-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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..b04fabda1b16 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs @@ -0,0 +1,182 @@ +// +// 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 DiagnosticSettingsOperations. + /// + public static partial class DiagnosticSettingsOperationsExtensions + { + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + public static DiagnosticSettingsResource Get(this IDiagnosticSettingsOperations operations, string resourceUri, string name) + { + return operations.GetAsync(resourceUri, name).GetAwaiter().GetResult(); + } + + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The name of the diagnostic setting. + /// + public static DiagnosticSettingsResource CreateOrUpdate(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name) + { + return operations.CreateOrUpdateAsync(resourceUri, parameters, name).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceUri, parameters, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + public static void Delete(this IDiagnosticSettingsOperations operations, string resourceUri, string name) + { + operations.DeleteAsync(resourceUri, name).GetAwaiter().GetResult(); + } + + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the active diagnostic settings list for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + public static DiagnosticSettingsResourceCollection List(this IDiagnosticSettingsOperations operations, string resourceUri) + { + return operations.ListAsync(resourceUri).GetAwaiter().GetResult(); + } + + /// + /// Gets the active diagnostic settings list for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IDiagnosticSettingsOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs new file mode 100644 index 000000000000..e5b727c56c84 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs @@ -0,0 +1,216 @@ +// +// 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; + + /// + /// EventCategoriesOperations operations. + /// + internal partial class EventCategoriesOperations : IServiceOperations, IEventCategoriesOperations + { + /// + /// Initializes a new instance of the EventCategoriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EventCategoriesOperations(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 list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2015-04-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("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("/") ? "" : "/")), "providers/Microsoft.Insights/eventcategories").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs new file mode 100644 index 000000000000..f4bd0714fd98 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs @@ -0,0 +1,59 @@ +// +// 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 EventCategoriesOperations. + /// + public static partial class EventCategoriesOperationsExtensions + { + /// + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IEventCategoriesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEventCategoriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs new file mode 100644 index 000000000000..79a99a34891e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs @@ -0,0 +1,82 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ActivityLogsOperations operations. + /// + public partial interface IActivityLogsOperations + { + /// + /// Provides the list of records from the activity logs. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Used to fetch events with only the given properties.<br>The + /// **$select** argument is a comma separated list of property names to + /// be returned. Possible values are: *authorization*, *claims*, + /// *correlationId*, *description*, *eventDataId*, *eventName*, + /// *eventTimestamp*, *httpRequest*, *level*, *operationId*, + /// *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, + /// *submissionTimestamp*, *subStatus*, *subscriptionId* + /// + /// + /// 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(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Provides the list of records from the activity logs. + /// + /// + /// 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)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs new file mode 100644 index 000000000000..8cb6ba8bf33c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs @@ -0,0 +1,172 @@ +// +// 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; + + /// + /// AlertRulesOperations operations. + /// + public partial interface IAlertRulesOperations + { + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a classic metric alert rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a classic metric alert rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing classic metric AlertRuleResource. To update + /// other fields use the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the classic metric alert rules within a 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)); + /// + /// List the classic metric alert rules 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs new file mode 100644 index 000000000000..1b889a958070 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs @@ -0,0 +1,216 @@ +// +// 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; + + /// + /// AutoscaleSettingsOperations operations. + /// + public partial interface IAutoscaleSettingsOperations + { + /// + /// Lists the autoscale settings for a 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)); + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes and autoscale setting + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// 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 autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an autoscale setting + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// 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 autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing AutoscaleSettingsResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the autoscale settings for a 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)); + /// + /// Lists the autoscale settings for 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)); + /// + /// Lists the autoscale settings for 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs new file mode 100644 index 000000000000..5a76f0c09ee8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs @@ -0,0 +1,93 @@ +// +// 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; + + /// + /// BaselinesOperations operations. + /// + public partial interface IBaselinesOperations + { + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special + /// case: If a metricname itself has a comma in it then use %2 to + /// indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. + /// Example: Metric contains metadata A, B and C. - Return all time + /// series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B + /// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + /// eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid + /// because the logical or operator cannot separate two different + /// metadata names. - Return all time series where A = a1, B = b1 and C + /// = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return + /// all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses + /// round brackets. Eg: When dimension name is **dim (test) 1** Instead + /// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim + /// %2528test%2529 1 eq '*' "** When dimension name is **dim (test) 3** + /// and dimension value is **dim3 (test) val** Instead of using + /// $filter= "dim (test) 3 eq 'dim3 (test) val' " use **$filter= "dim + /// %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request + /// all information is retrieved. Possible values include: 'Data', + /// 'Metadata' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs new file mode 100644 index 000000000000..ed683fb71e30 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs @@ -0,0 +1,125 @@ +// +// 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; + + /// + /// DiagnosticSettingsOperations operations. + /// + public partial interface IDiagnosticSettingsOperations + { + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the active diagnostic settings list 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> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs new file mode 100644 index 000000000000..80737e5455ef --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs @@ -0,0 +1,49 @@ +// +// 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; + + /// + /// EventCategoriesOperations operations. + /// + public partial interface IEventCategoriesOperations + { + /// + /// Get the list of available event categories supported in the + /// Activity Logs Service.<br>The current list includes the + /// following: Administrative, Security, ServiceHealth, Alert, + /// Recommendation, Policy. + /// + /// + /// 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)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs new file mode 100644 index 000000000000..f9d0fa23a80d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs @@ -0,0 +1,138 @@ +// +// 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; + + /// + /// LogProfilesOperations operations. + /// + public partial interface ILogProfilesOperations + { + /// + /// Deletes the log profile. + /// + /// + /// The name of the log profile. + /// + /// + /// 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 logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the log profile. + /// + /// + /// The name of the log profile. + /// + /// + /// 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 logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing LogProfilesResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the log profiles. + /// + /// + /// 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)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs new file mode 100644 index 000000000000..9e357c1520d3 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs @@ -0,0 +1,171 @@ +// +// 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; + + /// + /// MetricAlertsOperations operations. + /// + public partial interface IMetricAlertsOperations + { + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve alert rule definitions in a 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)); + /// + /// Retrieve an alert rule definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update an metric alert definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an metric alert definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an alert rule definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs new file mode 100644 index 000000000000..3974fcf5e51e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs @@ -0,0 +1,80 @@ +// +// 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; + + /// + /// MetricAlertsStatusOperations operations. + /// + public partial interface IMetricAlertsStatusOperations + { + /// + /// Retrieve an alert rule status. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve an alert rule status. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + /// + /// 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> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs new file mode 100644 index 000000000000..13beb545e854 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetricDefinitionsOperations operations. + /// + public partial interface IMetricDefinitionsOperations + { + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs new file mode 100644 index 000000000000..79fbc8945262 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetricNamespacesOperations operations. + /// + public partial interface IMetricNamespacesOperations + { + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs new file mode 100644 index 000000000000..26e01b9e62b2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs @@ -0,0 +1,87 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetricsOperations operations. + /// + public partial interface IMetricsOperations + { + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The identifier of the resource. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special + /// case: If a metricname itself has a comma in it then use %2 to + /// indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the + /// sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on + /// the operation. See the operation's description for details. + /// Possible values include: 'Data', 'Metadata' + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs new file mode 100644 index 000000000000..e41d54c62d81 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs @@ -0,0 +1,153 @@ +// +// 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; + + /// + /// Monitor Management Client + /// + public partial interface IMonitorManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IAutoscaleSettingsOperations. + /// + IAutoscaleSettingsOperations AutoscaleSettings { get; } + + /// + /// Gets the IAlertRulesOperations. + /// + IAlertRulesOperations AlertRules { get; } + + /// + /// Gets the ILogProfilesOperations. + /// + ILogProfilesOperations LogProfiles { get; } + + /// + /// Gets the IDiagnosticSettingsOperations. + /// + IDiagnosticSettingsOperations DiagnosticSettings { get; } + + /// + /// Gets the IActivityLogsOperations. + /// + IActivityLogsOperations ActivityLogs { get; } + + /// + /// Gets the IEventCategoriesOperations. + /// + IEventCategoriesOperations EventCategories { get; } + + /// + /// Gets the IMetricDefinitionsOperations. + /// + IMetricDefinitionsOperations MetricDefinitions { get; } + + /// + /// Gets the IMetricsOperations. + /// + IMetricsOperations Metrics { get; } + + /// + /// Gets the IBaselinesOperations. + /// + IBaselinesOperations Baselines { get; } + + /// + /// Gets the IMetricAlertsOperations. + /// + IMetricAlertsOperations MetricAlerts { get; } + + /// + /// Gets the IMetricAlertsStatusOperations. + /// + IMetricAlertsStatusOperations MetricAlertsStatus { get; } + + /// + /// Gets the IMetricNamespacesOperations. + /// + IMetricNamespacesOperations MetricNamespaces { 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; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..8c1c483472ce --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,212 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..75f9697b3ae9 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,105 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs new file mode 100644 index 000000000000..572210155e68 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// 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 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 asyncOperationId, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs new file mode 100644 index 000000000000..9d78062ea7b6 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs @@ -0,0 +1,214 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs new file mode 100644 index 000000000000..35aa285c547f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs @@ -0,0 +1,245 @@ +// +// 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 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)); + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs new file mode 100644 index 000000000000..a4dab2af3eb2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs @@ -0,0 +1,1007 @@ +// +// 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; + + /// + /// LogProfilesOperations operations. + /// + internal partial class LogProfilesOperations : IServiceOperations, ILogProfilesOperations + { + /// + /// Initializes a new instance of the LogProfilesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LogProfilesOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Deletes the log profile. + /// + /// + /// The name of the log profile. + /// + /// + /// 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 logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (logProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("logProfileName", logProfileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); + _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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 the log profile. + /// + /// + /// The name of the log profile. + /// + /// + /// 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 logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (logProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("logProfileName", logProfileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); + _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (logProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + 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 = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("logProfileName", logProfileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + 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}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); + _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + 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; + } + + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (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"); + } + if (logProfilesResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "logProfilesResource"); + } + string apiVersion = "2016-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("logProfileName", logProfileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("logProfilesResource", logProfilesResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(logProfilesResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(logProfilesResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the log profiles. + /// + /// + /// 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"); + } + 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; + 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/logprofiles").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; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs new file mode 100644 index 000000000000..90792ce0a5f1 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs @@ -0,0 +1,202 @@ +// +// 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 LogProfilesOperations. + /// + public static partial class LogProfilesOperationsExtensions + { + /// + /// Deletes the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static void Delete(this ILogProfilesOperations operations, string logProfileName) + { + operations.DeleteAsync(logProfileName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static LogProfileResource Get(this ILogProfilesOperations operations, string logProfileName) + { + return operations.GetAsync(logProfileName).GetAwaiter().GetResult(); + } + + /// + /// Gets the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + public static LogProfileResource CreateOrUpdate(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters) + { + return operations.CreateOrUpdateAsync(logProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(logProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + public static LogProfileResource Update(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource) + { + return operations.UpdateAsync(logProfileName, logProfilesResource).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// Parameters supplied to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(logProfileName, logProfilesResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the log profiles. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this ILogProfilesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List the log profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ILogProfilesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs new file mode 100644 index 000000000000..8cfc97286074 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs @@ -0,0 +1,1269 @@ +// +// 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; + + /// + /// MetricAlertsOperations operations. + /// + internal partial class MetricAlertsOperations : IServiceOperations, IMetricAlertsOperations + { + /// + /// Initializes a new instance of the MetricAlertsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricAlertsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> 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 = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/metricAlerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve alert rule definitions in a 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); + } + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("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/metricAlerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve an alert rule definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/metricAlerts/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update an metric alert definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + 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/metricAlerts/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update an metric alert definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + 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/metricAlerts/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete an alert rule definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// 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 ruleName, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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/metricAlerts/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs new file mode 100644 index 000000000000..7784b60e9ce0 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs @@ -0,0 +1,258 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + 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 MetricAlertsOperations. + /// + public static partial class MetricAlertsOperationsExtensions + { + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListBySubscription(this IMetricAlertsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IMetricAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve alert rule definitions in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListByResourceGroup(this IMetricAlertsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve alert rule definitions in a 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 IMetricAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertResource Get(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) + { + return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + public static MetricAlertResource CreateOrUpdate(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to update. + /// + public static MetricAlertResource Update(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters) + { + return operations.UpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The parameters of the rule to update. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static void Delete(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) + { + operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Delete an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs new file mode 100644 index 000000000000..5f1a9a47b786 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs @@ -0,0 +1,477 @@ +// +// 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; + + /// + /// MetricAlertsStatusOperations operations. + /// + internal partial class MetricAlertsStatusOperations : IServiceOperations, IMetricAlertsStatusOperations + { + /// + /// Initializes a new instance of the MetricAlertsStatusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricAlertsStatusOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Retrieve an alert rule status. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve an alert rule status. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + /// + /// 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> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, 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 (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (statusName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statusName"); + } + string apiVersion = "2018-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("statusName", statusName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByName", 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/metricAlerts/{ruleName}/status/{statusName}").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)); + _url = _url.Replace("{statusName}", System.Uri.EscapeDataString(statusName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs new file mode 100644 index 000000000000..e5a74a13dd15 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs @@ -0,0 +1,111 @@ +// +// 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 MetricAlertsStatusOperations. + /// + public static partial class MetricAlertsStatusOperationsExtensions + { + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertStatusCollection List(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName) + { + return operations.ListAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + public static MetricAlertStatusCollection ListByName(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName) + { + return operations.ListByNameAsync(resourceGroupName, ruleName, statusName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + /// + /// The cancellation token. + /// + public static async Task ListByNameAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByNameWithHttpMessagesAsync(resourceGroupName, ruleName, statusName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs new file mode 100644 index 000000000000..7e78831dfd41 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs @@ -0,0 +1,237 @@ +// +// 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; + + /// + /// MetricDefinitionsOperations operations. + /// + internal partial class MetricDefinitionsOperations : IServiceOperations, IMetricDefinitionsOperations + { + /// + /// Initializes a new instance of the MetricDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricDefinitionsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2018-01-01"; + // 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("metricnamespace", metricnamespace); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metricDefinitions").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 (metricnamespace != null) + { + _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..b7a408b6ca33 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// 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 MetricDefinitionsOperations. + /// + public static partial class MetricDefinitionsOperationsExtensions + { + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + public static IEnumerable List(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string)) + { + return operations.ListAsync(resourceUri, metricnamespace).GetAwaiter().GetResult(); + } + + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnamespace, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs new file mode 100644 index 000000000000..8e73a78d2a25 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs @@ -0,0 +1,238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetricNamespacesOperations operations. + /// + internal partial class MetricNamespacesOperations : IServiceOperations, IMetricNamespacesOperations + { + /// + /// Initializes a new instance of the MetricNamespacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricNamespacesOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2017-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceUri", resourceUri); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("startTime", startTime); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricNamespaces").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (startTime != null) + { + _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs new file mode 100644 index 000000000000..bf67203b2baf --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MetricNamespacesOperations. + /// + public static partial class MetricNamespacesOperationsExtensions + { + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + public static IEnumerable List(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string)) + { + return operations.ListAsync(resourceUri, startTime).GetAwaiter().GetResult(); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, startTime, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs new file mode 100644 index 000000000000..d7369c8dbb9f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs @@ -0,0 +1,315 @@ +// +// 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 Microsoft.Rest.Azure.OData; + 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; + + /// + /// MetricsOperations operations. + /// + internal partial class MetricsOperations : IServiceOperations, IMetricsOperations + { + /// + /// Initializes a new instance of the MetricsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetricsOperations(MonitorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MonitorManagementClient + /// + public MonitorManagementClient Client { get; private set; } + + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The identifier of the resource. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. Possible values + /// include: 'Data', 'Metadata' + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + } + string apiVersion = "2018-01-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceUri", resourceUri); + tracingParameters.Add("timespan", timespan); + tracingParameters.Add("interval", interval); + tracingParameters.Add("metricnames", metricnames); + tracingParameters.Add("aggregation", aggregation); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("resultType", resultType); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("metricnamespace", metricnamespace); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metrics").ToString(); + _url = _url.Replace("{resourceUri}", resourceUri); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (timespan != null) + { + _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); + } + if (interval != null) + { + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); + } + if (metricnames != null) + { + _queryParameters.Add(string.Format("metricnames={0}", System.Uri.EscapeDataString(metricnames))); + } + if (aggregation != null) + { + _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(aggregation))); + } + if (top != null) + { + _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (resultType != null) + { + _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (metricnamespace != null) + { + _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs new file mode 100644 index 000000000000..3be2a5704802 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs @@ -0,0 +1,132 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MetricsOperations. + /// + public static partial class MetricsOperationsExtensions + { + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. Possible values + /// include: 'Data', 'Metadata' + /// + /// + /// Metric namespace to query metric definitions for. + /// + public static Response List(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string)) + { + return operations.ListAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace).GetAwaiter().GetResult(); + } + + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. Possible values + /// include: 'Data', 'Metadata' + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs new file mode 100644 index 000000000000..fed1698e35fb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AggregationType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AggregationType + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Average")] + Average, + [EnumMember(Value = "Count")] + Count, + [EnumMember(Value = "Minimum")] + Minimum, + [EnumMember(Value = "Maximum")] + Maximum, + [EnumMember(Value = "Total")] + Total + } + internal static class AggregationTypeEnumExtension + { + internal static string ToSerializedValue(this AggregationType? value) + { + return value == null ? null : ((AggregationType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AggregationType value) + { + switch( value ) + { + case AggregationType.None: + return "None"; + case AggregationType.Average: + return "Average"; + case AggregationType.Count: + return "Count"; + case AggregationType.Minimum: + return "Minimum"; + case AggregationType.Maximum: + return "Maximum"; + case AggregationType.Total: + return "Total"; + } + return null; + } + + internal static AggregationType? ParseAggregationType(this string value) + { + switch( value ) + { + case "None": + return AggregationType.None; + case "Average": + return AggregationType.Average; + case "Count": + return AggregationType.Count; + case "Minimum": + return AggregationType.Minimum; + case "Maximum": + return AggregationType.Maximum; + case "Total": + return AggregationType.Total; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs new file mode 100644 index 000000000000..e2007d5c8ddc --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/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/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs new file mode 100644 index 000000000000..6c956147d4a5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs @@ -0,0 +1,149 @@ +// +// 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; + + /// + /// The alert rule resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class AlertRuleResource : Resource + { + /// + /// Initializes a new instance of the AlertRuleResource class. + /// + public AlertRuleResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleResource class. + /// + /// Resource location + /// the name of the alert + /// rule. + /// the flag that indicates whether the alert + /// rule is enabled. + /// the condition that results in the alert + /// rule being activated. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// the description of the alert rule that + /// will be included in the alert email. + /// the provisioning state. + /// action that is performed when the alert rule + /// becomes active, and when an alert condition is resolved. + /// the array of actions that are performed when + /// the alert rule becomes active, and when an alert condition is + /// resolved. + /// Last time the rule was updated in + /// ISO8601 format. + public AlertRuleResource(string location, string alertRuleResourceName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + AlertRuleResourceName = alertRuleResourceName; + Description = description; + ProvisioningState = provisioningState; + IsEnabled = isEnabled; + Condition = condition; + Action = action; + Actions = actions; + LastUpdatedTime = lastUpdatedTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the alert rule. + /// + [JsonProperty(PropertyName = "properties.name")] + public string AlertRuleResourceName { get; set; } + + /// + /// Gets or sets the description of the alert rule that will be + /// included in the alert email. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert rule is + /// enabled. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the condition that results in the alert rule being + /// activated. + /// + [JsonProperty(PropertyName = "properties.condition")] + public RuleCondition Condition { get; set; } + + /// + /// Gets or sets action that is performed when the alert rule becomes + /// active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.action")] + public RuleAction Action { get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert + /// rule becomes active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (AlertRuleResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleResourceName"); + } + if (Condition == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs new file mode 100644 index 000000000000..002d92250887 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs @@ -0,0 +1,149 @@ +// +// 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; + + /// + /// The alert rule object for patch operations. + /// + [Rest.Serialization.JsonTransformation] + public partial class AlertRuleResourcePatch + { + /// + /// Initializes a new instance of the AlertRuleResourcePatch class. + /// + public AlertRuleResourcePatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleResourcePatch class. + /// + /// the name of the alert rule. + /// the flag that indicates whether the alert + /// rule is enabled. + /// the condition that results in the alert + /// rule being activated. + /// Resource tags + /// the description of the alert rule that + /// will be included in the alert email. + /// the provisioning state. + /// action that is performed when the alert rule + /// becomes active, and when an alert condition is resolved. + /// the array of actions that are performed when + /// the alert rule becomes active, and when an alert condition is + /// resolved. + /// Last time the rule was updated in + /// ISO8601 format. + public AlertRuleResourcePatch(string name, bool isEnabled, RuleCondition condition, IDictionary tags = default(IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + { + Tags = tags; + Name = name; + Description = description; + ProvisioningState = provisioningState; + IsEnabled = isEnabled; + Condition = condition; + Action = action; + Actions = actions; + LastUpdatedTime = lastUpdatedTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the name of the alert rule. + /// + [JsonProperty(PropertyName = "properties.name")] + public string Name { get; set; } + + /// + /// Gets or sets the description of the alert rule that will be + /// included in the alert email. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert rule is + /// enabled. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the condition that results in the alert rule being + /// activated. + /// + [JsonProperty(PropertyName = "properties.condition")] + public RuleCondition Condition { get; set; } + + /// + /// Gets or sets action that is performed when the alert rule becomes + /// active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.action")] + public RuleAction Action { get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert + /// rule becomes active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Condition == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs new file mode 100644 index 000000000000..8ac9f845761d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs @@ -0,0 +1,76 @@ +// +// 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; + + /// + /// Autoscale notification. + /// + public partial class AutoscaleNotification + { + /// + /// Initializes a new instance of the AutoscaleNotification class. + /// + public AutoscaleNotification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoscaleNotification class. + /// + /// the email notification. + /// the collection of webhook + /// notifications. + public AutoscaleNotification(EmailNotification email = default(EmailNotification), IList webhooks = default(IList)) + { + Email = email; + Webhooks = webhooks; + CustomInit(); + } + /// + /// Static constructor for AutoscaleNotification class. + /// + static AutoscaleNotification() + { + Operation = "Scale"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the email notification. + /// + [JsonProperty(PropertyName = "email")] + public EmailNotification Email { get; set; } + + /// + /// Gets or sets the collection of webhook notifications. + /// + [JsonProperty(PropertyName = "webhooks")] + public IList Webhooks { get; set; } + + /// + /// the operation associated with the notification and its value must + /// be "scale" + /// + [JsonProperty(PropertyName = "operation")] + public static string Operation { get; private set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs new file mode 100644 index 000000000000..ac0e4a09c11f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Autoscale profile. + /// + public partial class AutoscaleProfile + { + /// + /// Initializes a new instance of the AutoscaleProfile class. + /// + public AutoscaleProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoscaleProfile class. + /// + /// the name of the profile. + /// the number of instances that can be used + /// during this profile. + /// the collection of rules that provide the + /// triggers and parameters for the scaling action. A maximum of 10 + /// rules can be specified. + /// the specific date-time for the profile. + /// This element is not used if the Recurrence element is used. + /// the repeating times at which this profile + /// begins. This element is not used if the FixedDate element is + /// used. + public AutoscaleProfile(string name, ScaleCapacity capacity, IList rules, TimeWindow fixedDate = default(TimeWindow), Recurrence recurrence = default(Recurrence)) + { + Name = name; + Capacity = capacity; + Rules = rules; + FixedDate = fixedDate; + Recurrence = recurrence; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the profile. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of instances that can be used during this + /// profile. + /// + [JsonProperty(PropertyName = "capacity")] + public ScaleCapacity Capacity { get; set; } + + /// + /// Gets or sets the collection of rules that provide the triggers and + /// parameters for the scaling action. A maximum of 10 rules can be + /// specified. + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + /// + /// Gets or sets the specific date-time for the profile. This element + /// is not used if the Recurrence element is used. + /// + [JsonProperty(PropertyName = "fixedDate")] + public TimeWindow FixedDate { get; set; } + + /// + /// Gets or sets the repeating times at which this profile begins. This + /// element is not used if the FixedDate element is used. + /// + [JsonProperty(PropertyName = "recurrence")] + public Recurrence Recurrence { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Capacity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Capacity"); + } + if (Rules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); + } + if (Capacity != null) + { + Capacity.Validate(); + } + if (Rules != null) + { + foreach (var element in Rules) + { + if (element != null) + { + element.Validate(); + } + } + } + if (FixedDate != null) + { + FixedDate.Validate(); + } + if (Recurrence != null) + { + Recurrence.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs new file mode 100644 index 000000000000..d888e469a939 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs @@ -0,0 +1,143 @@ +// +// 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; + + /// + /// The autoscale setting resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class AutoscaleSettingResource : Resource + { + /// + /// Initializes a new instance of the AutoscaleSettingResource class. + /// + public AutoscaleSettingResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoscaleSettingResource class. + /// + /// Resource location + /// the collection of automatic scaling profiles + /// that specify different scaling parameters for different time + /// periods. A maximum of 20 profiles can be specified. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// the collection of + /// notifications. + /// the enabled flag. Specifies whether automatic + /// scaling is enabled for the resource. The default value is + /// 'true'. + /// the name of the + /// autoscale setting. + /// the resource identifier of the + /// resource that the autoscale setting should be added to. + /// the location of the resource + /// that the autoscale setting should be added to. + public AutoscaleSettingResource(string location, IList profiles, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string autoscaleSettingResourceName = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + : base(location, id, name, type, tags) + { + Profiles = profiles; + Notifications = notifications; + Enabled = enabled; + AutoscaleSettingResourceName = autoscaleSettingResourceName; + TargetResourceUri = targetResourceUri; + TargetResourceLocation = targetResourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the collection of automatic scaling profiles that + /// specify different scaling parameters for different time periods. A + /// maximum of 20 profiles can be specified. + /// + [JsonProperty(PropertyName = "properties.profiles")] + public IList Profiles { get; set; } + + /// + /// Gets or sets the collection of notifications. + /// + [JsonProperty(PropertyName = "properties.notifications")] + public IList Notifications { get; set; } + + /// + /// Gets or sets the enabled flag. Specifies whether automatic scaling + /// is enabled for the resource. The default value is 'true'. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the name of the autoscale setting. + /// + [JsonProperty(PropertyName = "properties.name")] + public string AutoscaleSettingResourceName { get; set; } + + /// + /// Gets or sets the resource identifier of the resource that the + /// autoscale setting should be added to. + /// + [JsonProperty(PropertyName = "properties.targetResourceUri")] + public string TargetResourceUri { get; set; } + + /// + /// Gets or sets the location of the resource that the autoscale + /// setting should be added to. + /// + [JsonProperty(PropertyName = "properties.targetResourceLocation")] + public string TargetResourceLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Profiles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); + } + if (Profiles != null) + { + if (Profiles.Count > 20) + { + throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); + } + foreach (var element in Profiles) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs new file mode 100644 index 000000000000..c23a95232d7f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs @@ -0,0 +1,145 @@ +// +// 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; + + /// + /// The autoscale setting object for patch operations. + /// + [Rest.Serialization.JsonTransformation] + public partial class AutoscaleSettingResourcePatch + { + /// + /// Initializes a new instance of the AutoscaleSettingResourcePatch + /// class. + /// + public AutoscaleSettingResourcePatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoscaleSettingResourcePatch + /// class. + /// + /// the collection of automatic scaling profiles + /// that specify different scaling parameters for different time + /// periods. A maximum of 20 profiles can be specified. + /// Resource tags + /// the collection of + /// notifications. + /// the enabled flag. Specifies whether automatic + /// scaling is enabled for the resource. The default value is + /// 'true'. + /// the name of the autoscale setting. + /// the resource identifier of the + /// resource that the autoscale setting should be added to. + /// the location of the resource + /// that the autoscale setting should be added to. + public AutoscaleSettingResourcePatch(IList profiles, IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + { + Tags = tags; + Profiles = profiles; + Notifications = notifications; + Enabled = enabled; + Name = name; + TargetResourceUri = targetResourceUri; + TargetResourceLocation = targetResourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the collection of automatic scaling profiles that + /// specify different scaling parameters for different time periods. A + /// maximum of 20 profiles can be specified. + /// + [JsonProperty(PropertyName = "properties.profiles")] + public IList Profiles { get; set; } + + /// + /// Gets or sets the collection of notifications. + /// + [JsonProperty(PropertyName = "properties.notifications")] + public IList Notifications { get; set; } + + /// + /// Gets or sets the enabled flag. Specifies whether automatic scaling + /// is enabled for the resource. The default value is 'true'. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the name of the autoscale setting. + /// + [JsonProperty(PropertyName = "properties.name")] + public string Name { get; set; } + + /// + /// Gets or sets the resource identifier of the resource that the + /// autoscale setting should be added to. + /// + [JsonProperty(PropertyName = "properties.targetResourceUri")] + public string TargetResourceUri { get; set; } + + /// + /// Gets or sets the location of the resource that the autoscale + /// setting should be added to. + /// + [JsonProperty(PropertyName = "properties.targetResourceLocation")] + public string TargetResourceLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Profiles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); + } + if (Profiles != null) + { + if (Profiles.Count > 20) + { + throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); + } + foreach (var element in Profiles) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs new file mode 100644 index 000000000000..47dbcf85231d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs @@ -0,0 +1,100 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs new file mode 100644 index 000000000000..fa234fe8bac1 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a baseline metadata value. + /// + public partial class BaselineMetadata + { + /// + /// Initializes a new instance of the BaselineMetadata class. + /// + public BaselineMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BaselineMetadata class. + /// + /// Name of the baseline metadata. + /// Value of the baseline metadata. + public BaselineMetadata(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the baseline metadata. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets value of the baseline metadata. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs new file mode 100644 index 000000000000..4170b0895b20 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for BaselineSensitivity. + /// + public static class BaselineSensitivity + { + public const string Low = "Low"; + public const string Medium = "Medium"; + public const string High = "High"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs new file mode 100644 index 000000000000..7c4846aeb1f2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ComparisonOperationType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ComparisonOperationType + { + [EnumMember(Value = "Equals")] + Equals, + [EnumMember(Value = "NotEquals")] + NotEquals, + [EnumMember(Value = "GreaterThan")] + GreaterThan, + [EnumMember(Value = "GreaterThanOrEqual")] + GreaterThanOrEqual, + [EnumMember(Value = "LessThan")] + LessThan, + [EnumMember(Value = "LessThanOrEqual")] + LessThanOrEqual + } + internal static class ComparisonOperationTypeEnumExtension + { + internal static string ToSerializedValue(this ComparisonOperationType? value) + { + return value == null ? null : ((ComparisonOperationType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ComparisonOperationType value) + { + switch( value ) + { + case ComparisonOperationType.Equals: + return "Equals"; + case ComparisonOperationType.NotEquals: + return "NotEquals"; + case ComparisonOperationType.GreaterThan: + return "GreaterThan"; + case ComparisonOperationType.GreaterThanOrEqual: + return "GreaterThanOrEqual"; + case ComparisonOperationType.LessThan: + return "LessThan"; + case ComparisonOperationType.LessThanOrEqual: + return "LessThanOrEqual"; + } + return null; + } + + internal static ComparisonOperationType? ParseComparisonOperationType(this string value) + { + switch( value ) + { + case "Equals": + return ComparisonOperationType.Equals; + case "NotEquals": + return ComparisonOperationType.NotEquals; + case "GreaterThan": + return ComparisonOperationType.GreaterThan; + case "GreaterThanOrEqual": + return ComparisonOperationType.GreaterThanOrEqual; + case "LessThan": + return ComparisonOperationType.LessThan; + case "LessThanOrEqual": + return ComparisonOperationType.LessThanOrEqual; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs new file mode 100644 index 000000000000..7b4003f6cb1d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ConditionOperator. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ConditionOperator + { + [EnumMember(Value = "GreaterThan")] + GreaterThan, + [EnumMember(Value = "GreaterThanOrEqual")] + GreaterThanOrEqual, + [EnumMember(Value = "LessThan")] + LessThan, + [EnumMember(Value = "LessThanOrEqual")] + LessThanOrEqual + } + internal static class ConditionOperatorEnumExtension + { + internal static string ToSerializedValue(this ConditionOperator? value) + { + return value == null ? null : ((ConditionOperator)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ConditionOperator value) + { + switch( value ) + { + case ConditionOperator.GreaterThan: + return "GreaterThan"; + case ConditionOperator.GreaterThanOrEqual: + return "GreaterThanOrEqual"; + case ConditionOperator.LessThan: + return "LessThan"; + case ConditionOperator.LessThanOrEqual: + return "LessThanOrEqual"; + } + return null; + } + + internal static ConditionOperator? ParseConditionOperator(this string value) + { + switch( value ) + { + case "GreaterThan": + return ConditionOperator.GreaterThan; + case "GreaterThanOrEqual": + return ConditionOperator.GreaterThanOrEqual; + case "LessThan": + return ConditionOperator.LessThan; + case "LessThanOrEqual": + return ConditionOperator.LessThanOrEqual; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs new file mode 100644 index 000000000000..cacc1ef47e8e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs @@ -0,0 +1,139 @@ +// +// 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; + + /// + /// The diagnostic setting resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiagnosticSettingsResource : ProxyOnlyResource + { + /// + /// Initializes a new instance of the DiagnosticSettingsResource class. + /// + public DiagnosticSettingsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticSettingsResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The resource ID of the storage + /// account to which you would like to send Diagnostic Logs. + /// The service bus rule Id of the + /// diagnostic setting. This is here to maintain backwards + /// compatibility. + /// The resource Id for the + /// event hub authorization rule. + /// The name of the event hub. If none is + /// specified, the default event hub will be selected. + /// The list of metric settings. + /// The list of logs settings. + /// The full ARM resource ID of the Log + /// Analytics workspace to which you would like to send Diagnostic + /// Logs. Example: + /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + /// A string indicating + /// whether the export to Log Analytics should use the default + /// destination type, i.e. AzureDiagnostics, or use a destination type + /// constructed as follows: <normalized service + /// identity>_<normalized category name>. Possible values are: + /// Dedicated and null (null is default.) + public DiagnosticSettingsResource(string id = default(string), string name = default(string), string type = default(string), string storageAccountId = default(string), string serviceBusRuleId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), IList metrics = default(IList), IList logs = default(IList), string workspaceId = default(string), string logAnalyticsDestinationType = default(string)) + : base(id, name, type) + { + StorageAccountId = storageAccountId; + ServiceBusRuleId = serviceBusRuleId; + EventHubAuthorizationRuleId = eventHubAuthorizationRuleId; + EventHubName = eventHubName; + Metrics = metrics; + Logs = logs; + WorkspaceId = workspaceId; + LogAnalyticsDestinationType = logAnalyticsDestinationType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the storage account to which you + /// would like to send Diagnostic Logs. + /// + [JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Gets or sets the service bus rule Id of the diagnostic setting. + /// This is here to maintain backwards compatibility. + /// + [JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId { get; set; } + + /// + /// Gets or sets the resource Id for the event hub authorization rule. + /// + [JsonProperty(PropertyName = "properties.eventHubAuthorizationRuleId")] + public string EventHubAuthorizationRuleId { get; set; } + + /// + /// Gets or sets the name of the event hub. If none is specified, the + /// default event hub will be selected. + /// + [JsonProperty(PropertyName = "properties.eventHubName")] + public string EventHubName { get; set; } + + /// + /// Gets or sets the list of metric settings. + /// + [JsonProperty(PropertyName = "properties.metrics")] + public IList Metrics { get; set; } + + /// + /// Gets or sets the list of logs settings. + /// + [JsonProperty(PropertyName = "properties.logs")] + public IList Logs { get; set; } + + /// + /// Gets or sets the full ARM resource ID of the Log Analytics + /// workspace to which you would like to send Diagnostic Logs. Example: + /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + /// + [JsonProperty(PropertyName = "properties.workspaceId")] + public string WorkspaceId { get; set; } + + /// + /// Gets or sets a string indicating whether the export to Log + /// Analytics should use the default destination type, i.e. + /// AzureDiagnostics, or use a destination type constructed as follows: + /// &lt;normalized service identity&gt;_&lt;normalized + /// category name&gt;. Possible values are: Dedicated and null + /// (null is default.) + /// + [JsonProperty(PropertyName = "properties.logAnalyticsDestinationType")] + public string LogAnalyticsDestinationType { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs new file mode 100644 index 000000000000..2ee813f37406 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs @@ -0,0 +1,56 @@ +// +// 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; + + /// + /// Represents a collection of alert rule resources. + /// + public partial class DiagnosticSettingsResourceCollection + { + /// + /// Initializes a new instance of the + /// DiagnosticSettingsResourceCollection class. + /// + public DiagnosticSettingsResourceCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DiagnosticSettingsResourceCollection class. + /// + /// The collection of diagnostic settings + /// resources;. + public DiagnosticSettingsResourceCollection(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the collection of diagnostic settings resources;. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs new file mode 100644 index 000000000000..8dad3fa1d3f0 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Criterion for dynamic threshold. + /// + [Newtonsoft.Json.JsonObject("DynamicThresholdCriterion")] + public partial class DynamicMetricCriteria : MultiMetricCriteria + { + /// + /// Initializes a new instance of the DynamicMetricCriteria class. + /// + public DynamicMetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DynamicMetricCriteria class. + /// + /// Name of the criteria. + /// Name of the metric. + /// 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' + /// The extent of deviation required to + /// trigger an alert. This will affect how tight the threshold is to + /// the metric series pattern. Possible values include: 'Low', + /// 'Medium', 'High' + /// The minimum number of violations + /// required within the selected lookback time window required to raise + /// an alert. + /// Unmatched properties from the + /// message are deserialized this collection + /// Namespace of the metric. + /// List of dimension conditions. + /// Allows creating an alert rule on + /// a custom metric that isn't yet emitted, by causing the metric + /// validation to be skipped. + /// 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, 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; + AlertSensitivity = alertSensitivity; + FailingPeriods = failingPeriods; + IgnoreDataBefore = ignoreDataBefore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operator used to compare the metric value against + /// the threshold. Possible values include: 'GreaterThan', 'LessThan', + /// 'GreaterOrLessThan' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets the extent of deviation required to trigger an alert. + /// This will affect how tight the threshold is to the metric series + /// pattern. Possible values include: 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "alertSensitivity")] + public string AlertSensitivity { get; set; } + + /// + /// Gets or sets the minimum number of violations required within the + /// selected lookback time window required to raise an alert. + /// + [JsonProperty(PropertyName = "failingPeriods")] + public DynamicThresholdFailingPeriods FailingPeriods { get; set; } + + /// + /// Gets or sets use this option to set the date from which to start + /// learning the metric historical data and calculate the dynamic + /// thresholds (in ISO8601 format) + /// + [JsonProperty(PropertyName = "ignoreDataBefore")] + public System.DateTime? IgnoreDataBefore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (AlertSensitivity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertSensitivity"); + } + if (FailingPeriods == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FailingPeriods"); + } + if (FailingPeriods != null) + { + FailingPeriods.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs new file mode 100644 index 000000000000..013569f048c5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs @@ -0,0 +1,80 @@ +// +// 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 minimum number of violations required within the selected lookback + /// time window required to raise an alert. + /// + public partial class DynamicThresholdFailingPeriods + { + /// + /// Initializes a new instance of the DynamicThresholdFailingPeriods + /// class. + /// + public DynamicThresholdFailingPeriods() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DynamicThresholdFailingPeriods + /// class. + /// + /// The number of aggregated + /// lookback points. The lookback time window is calculated based on + /// the aggregation granularity (windowSize) and the selected number of + /// aggregated points. + /// The number of violations to + /// trigger an alert. Should be smaller or equal to + /// numberOfEvaluationPeriods. + public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double minFailingPeriodsToAlert) + { + NumberOfEvaluationPeriods = numberOfEvaluationPeriods; + MinFailingPeriodsToAlert = minFailingPeriodsToAlert; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of aggregated lookback points. The lookback + /// time window is calculated based on the aggregation granularity + /// (windowSize) and the selected number of aggregated points. + /// + [JsonProperty(PropertyName = "numberOfEvaluationPeriods")] + public double NumberOfEvaluationPeriods { get; set; } + + /// + /// Gets or sets the number of violations to trigger an alert. Should + /// be smaller or equal to numberOfEvaluationPeriods. + /// + [JsonProperty(PropertyName = "minFailingPeriodsToAlert")] + public double MinFailingPeriodsToAlert { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs new file mode 100644 index 000000000000..a887196950ae --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for DynamicThresholdOperator. + /// + public static class DynamicThresholdOperator + { + public const string GreaterThan = "GreaterThan"; + public const string LessThan = "LessThan"; + public const string GreaterOrLessThan = "GreaterOrLessThan"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs new file mode 100644 index 000000000000..1b8751ab78b3 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for DynamicThresholdSensitivity. + /// + public static class DynamicThresholdSensitivity + { + public const string Low = "Low"; + public const string Medium = "Medium"; + public const string High = "High"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs new file mode 100644 index 000000000000..ba475ecb62f2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs @@ -0,0 +1,76 @@ +// +// 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; + + /// + /// Email notification of an autoscale event. + /// + public partial class EmailNotification + { + /// + /// Initializes a new instance of the EmailNotification class. + /// + public EmailNotification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EmailNotification class. + /// + /// a value indicating + /// whether to send email to subscription administrator. + /// a value indicating + /// whether to send email to subscription co-administrators. + /// the custom e-mails list. This value can + /// be null or empty, in which case this attribute will be + /// ignored. + public EmailNotification(bool? sendToSubscriptionAdministrator = default(bool?), bool? sendToSubscriptionCoAdministrators = default(bool?), IList customEmails = default(IList)) + { + SendToSubscriptionAdministrator = sendToSubscriptionAdministrator; + SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; + CustomEmails = customEmails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a value indicating whether to send email to + /// subscription administrator. + /// + [JsonProperty(PropertyName = "sendToSubscriptionAdministrator")] + public bool? SendToSubscriptionAdministrator { get; set; } + + /// + /// Gets or sets a value indicating whether to send email to + /// subscription co-administrators. + /// + [JsonProperty(PropertyName = "sendToSubscriptionCoAdministrators")] + public bool? SendToSubscriptionCoAdministrators { get; set; } + + /// + /// Gets or sets the custom e-mails list. This value can be null or + /// empty, in which case this attribute will be ignored. + /// + [JsonProperty(PropertyName = "customEmails")] + public IList CustomEmails { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..05bf1fbd6ec3 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..2f93fbb9e247 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// Describes the format of Error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// Error code + /// Error message indicating why the operation + /// failed. + public ErrorResponse(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message indicating why the operation failed. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs new file mode 100644 index 000000000000..03e89dfa4cbc --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs @@ -0,0 +1,65 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs new file mode 100644 index 000000000000..f68f9794927a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..ad8fecdf5136 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : 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 ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs new file mode 100644 index 000000000000..91dc9e9d304d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs @@ -0,0 +1,339 @@ +// +// 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 Azure event log entries are of type EventData + /// + public partial class EventData + { + /// + /// Initializes a new instance of the EventData class. + /// + public EventData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventData class. + /// + /// The sender authorization + /// information. + /// key value pairs to identify ARM + /// permissions. + /// the email address of the user who has + /// performed the operation, the UPN claim or SPN claim based on + /// availability. + /// the description of the event. + /// the Id of this event as required by ARM for RBAC. + /// It contains the EventDataID and a timestamp information. + /// the event data Id. This is a unique + /// identifier for an event. + /// the correlation Id, usually a GUID in + /// the string format. The correlation Id is shared among the events + /// that belong to the same uber operation. + /// the event name. This value should not be + /// confused with OperationName. For practical purposes, OperationName + /// might be more appealing to end users. + /// the event category. + /// the HTTP request info. Usually includes + /// the 'clientRequestId', 'clientIpAddress' (IP address of the user + /// who initiated the event) and 'method' (HTTP method e.g. + /// PUT). + /// the event level. Possible values include: + /// 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + /// the resource group name of the + /// impacted resource. + /// the resource provider name of + /// the impacted resource. + /// the resource uri that uniquely identifies + /// the resource that caused this event. + /// the resource type + /// It is usually a GUID shared among the + /// events corresponding to single operation. This value should not be + /// confused with EventName. + /// the operation name. + /// the set of <Key, Value> pairs + /// (usually a Dictionary<String, String>) that includes details + /// about the event. + /// a string describing the status of the + /// operation. Some typical values are: Started, In progress, + /// Succeeded, Failed, Resolved. + /// the event sub status. Most of the time, + /// when included, this captures the HTTP status code of the REST call. + /// Common values are: OK (HTTP Status Code: 200), Created (HTTP Status + /// Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP + /// Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found + /// (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal + /// Server Error (HTTP Status Code: 500), Service Unavailable (HTTP + /// Status Code:503), Gateway Timeout (HTTP Status Code: 504) + /// the timestamp of when the event was + /// generated by the Azure service processing the request corresponding + /// the event. It in ISO 8601 format. + /// the timestamp of when the event + /// became available for querying via this API. It is in ISO 8601 + /// format. This value should not be confused eventTimestamp. As there + /// might be a delay between the occurrence time of the event, and the + /// time that the event is submitted to the Azure logging + /// infrastructure. + /// the Azure subscription Id usually a + /// GUID. + /// the Azure tenant Id + public EventData(SenderAuthorization authorization = default(SenderAuthorization), IDictionary claims = default(IDictionary), string caller = default(string), string description = default(string), string id = default(string), string eventDataId = default(string), string correlationId = default(string), LocalizableString eventName = default(LocalizableString), LocalizableString category = default(LocalizableString), HttpRequestInfo httpRequest = default(HttpRequestInfo), EventLevel? level = default(EventLevel?), string resourceGroupName = default(string), LocalizableString resourceProviderName = default(LocalizableString), string resourceId = default(string), LocalizableString resourceType = default(LocalizableString), string operationId = default(string), LocalizableString operationName = default(LocalizableString), IDictionary properties = default(IDictionary), LocalizableString status = default(LocalizableString), LocalizableString subStatus = default(LocalizableString), System.DateTime? eventTimestamp = default(System.DateTime?), System.DateTime? submissionTimestamp = default(System.DateTime?), string subscriptionId = default(string), string tenantId = default(string)) + { + Authorization = authorization; + Claims = claims; + Caller = caller; + Description = description; + Id = id; + EventDataId = eventDataId; + CorrelationId = correlationId; + EventName = eventName; + Category = category; + HttpRequest = httpRequest; + Level = level; + ResourceGroupName = resourceGroupName; + ResourceProviderName = resourceProviderName; + ResourceId = resourceId; + ResourceType = resourceType; + OperationId = operationId; + OperationName = operationName; + Properties = properties; + Status = status; + SubStatus = subStatus; + EventTimestamp = eventTimestamp; + SubmissionTimestamp = submissionTimestamp; + SubscriptionId = subscriptionId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the sender authorization information. + /// + [JsonProperty(PropertyName = "authorization")] + public SenderAuthorization Authorization { get; private set; } + + /// + /// Gets key value pairs to identify ARM permissions. + /// + [JsonProperty(PropertyName = "claims")] + public IDictionary Claims { get; private set; } + + /// + /// Gets the email address of the user who has performed the operation, + /// the UPN claim or SPN claim based on availability. + /// + [JsonProperty(PropertyName = "caller")] + public string Caller { get; private set; } + + /// + /// Gets the description of the event. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets the Id of this event as required by ARM for RBAC. It contains + /// the EventDataID and a timestamp information. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the event data Id. This is a unique identifier for an event. + /// + [JsonProperty(PropertyName = "eventDataId")] + public string EventDataId { get; private set; } + + /// + /// Gets the correlation Id, usually a GUID in the string format. The + /// correlation Id is shared among the events that belong to the same + /// uber operation. + /// + [JsonProperty(PropertyName = "correlationId")] + public string CorrelationId { get; private set; } + + /// + /// Gets the event name. This value should not be confused with + /// OperationName. For practical purposes, OperationName might be more + /// appealing to end users. + /// + [JsonProperty(PropertyName = "eventName")] + public LocalizableString EventName { get; private set; } + + /// + /// Gets the event category. + /// + [JsonProperty(PropertyName = "category")] + public LocalizableString Category { get; private set; } + + /// + /// Gets the HTTP request info. Usually includes the 'clientRequestId', + /// 'clientIpAddress' (IP address of the user who initiated the event) + /// and 'method' (HTTP method e.g. PUT). + /// + [JsonProperty(PropertyName = "httpRequest")] + public HttpRequestInfo HttpRequest { get; private set; } + + /// + /// Gets the event level. Possible values include: 'Critical', 'Error', + /// 'Warning', 'Informational', 'Verbose' + /// + [JsonProperty(PropertyName = "level")] + public EventLevel? Level { get; private set; } + + /// + /// Gets the resource group name of the impacted resource. + /// + [JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName { get; private set; } + + /// + /// Gets the resource provider name of the impacted resource. + /// + [JsonProperty(PropertyName = "resourceProviderName")] + public LocalizableString ResourceProviderName { get; private set; } + + /// + /// Gets the resource uri that uniquely identifies the resource that + /// caused this event. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; private set; } + + /// + /// Gets the resource type + /// + [JsonProperty(PropertyName = "resourceType")] + public LocalizableString ResourceType { get; private set; } + + /// + /// Gets it is usually a GUID shared among the events corresponding to + /// single operation. This value should not be confused with EventName. + /// + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; private set; } + + /// + /// Gets the operation name. + /// + [JsonProperty(PropertyName = "operationName")] + public LocalizableString OperationName { get; private set; } + + /// + /// Gets the set of &lt;Key, Value&gt; pairs (usually a + /// Dictionary&lt;String, String&gt;) that includes details + /// about the event. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + + /// + /// Gets a string describing the status of the operation. Some typical + /// values are: Started, In progress, Succeeded, Failed, Resolved. + /// + [JsonProperty(PropertyName = "status")] + public LocalizableString Status { get; private set; } + + /// + /// Gets the event sub status. Most of the time, when included, this + /// captures the HTTP status code of the REST call. Common values are: + /// OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), + /// Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: + /// 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status + /// Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error + /// (HTTP Status Code: 500), Service Unavailable (HTTP Status + /// Code:503), Gateway Timeout (HTTP Status Code: 504) + /// + [JsonProperty(PropertyName = "subStatus")] + public LocalizableString SubStatus { get; private set; } + + /// + /// Gets the timestamp of when the event was generated by the Azure + /// service processing the request corresponding the event. It in ISO + /// 8601 format. + /// + [JsonProperty(PropertyName = "eventTimestamp")] + public System.DateTime? EventTimestamp { get; private set; } + + /// + /// Gets the timestamp of when the event became available for querying + /// via this API. It is in ISO 8601 format. This value should not be + /// confused eventTimestamp. As there might be a delay between the + /// occurrence time of the event, and the time that the event is + /// submitted to the Azure logging infrastructure. + /// + [JsonProperty(PropertyName = "submissionTimestamp")] + public System.DateTime? SubmissionTimestamp { get; private set; } + + /// + /// Gets the Azure subscription Id usually a GUID. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets the Azure tenant Id + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EventName != null) + { + EventName.Validate(); + } + if (Category != null) + { + Category.Validate(); + } + if (ResourceProviderName != null) + { + ResourceProviderName.Validate(); + } + if (ResourceType != null) + { + ResourceType.Validate(); + } + if (OperationName != null) + { + OperationName.Validate(); + } + if (Status != null) + { + Status.Validate(); + } + if (SubStatus != null) + { + SubStatus.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs new file mode 100644 index 000000000000..ac449a2bab87 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs @@ -0,0 +1,78 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for EventLevel. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EventLevel + { + [EnumMember(Value = "Critical")] + Critical, + [EnumMember(Value = "Error")] + Error, + [EnumMember(Value = "Warning")] + Warning, + [EnumMember(Value = "Informational")] + Informational, + [EnumMember(Value = "Verbose")] + Verbose + } + internal static class EventLevelEnumExtension + { + internal static string ToSerializedValue(this EventLevel? value) + { + return value == null ? null : ((EventLevel)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this EventLevel value) + { + switch( value ) + { + case EventLevel.Critical: + return "Critical"; + case EventLevel.Error: + return "Error"; + case EventLevel.Warning: + return "Warning"; + case EventLevel.Informational: + return "Informational"; + case EventLevel.Verbose: + return "Verbose"; + } + return null; + } + + internal static EventLevel? ParseEventLevel(this string value) + { + switch( value ) + { + case "Critical": + return EventLevel.Critical; + case "Error": + return EventLevel.Error; + case "Warning": + return EventLevel.Warning; + case "Informational": + return EventLevel.Informational; + case "Verbose": + return EventLevel.Verbose; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs new file mode 100644 index 000000000000..142ff887d3f5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs @@ -0,0 +1,75 @@ +// +// 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 Http request info. + /// + public partial class HttpRequestInfo + { + /// + /// Initializes a new instance of the HttpRequestInfo class. + /// + public HttpRequestInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpRequestInfo class. + /// + /// the client request id. + /// the client Ip Address + /// the Http request method. + /// the Uri. + public HttpRequestInfo(string clientRequestId = default(string), string clientIpAddress = default(string), string method = default(string), string uri = default(string)) + { + ClientRequestId = clientRequestId; + ClientIpAddress = clientIpAddress; + Method = method; + Uri = uri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the client request id. + /// + [JsonProperty(PropertyName = "clientRequestId")] + public string ClientRequestId { get; set; } + + /// + /// Gets or sets the client Ip Address + /// + [JsonProperty(PropertyName = "clientIpAddress")] + public string ClientIpAddress { get; set; } + + /// + /// Gets or sets the Http request method. + /// + [JsonProperty(PropertyName = "method")] + public string Method { get; set; } + + /// + /// Gets or sets the Uri. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs new file mode 100644 index 000000000000..6db03f4d1e61 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs @@ -0,0 +1,73 @@ +// +// 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; + + /// + /// The localizable string class. + /// + public partial class LocalizableString + { + /// + /// Initializes a new instance of the LocalizableString class. + /// + public LocalizableString() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LocalizableString class. + /// + /// the invariant value. + /// the locale specific value. + public LocalizableString(string value, string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the invariant value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the locale specific value. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs new file mode 100644 index 000000000000..d8cfb0db1d24 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs @@ -0,0 +1,87 @@ +// +// 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; + + /// + /// A rule condition based on a certain number of locations failing. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition")] + public partial class LocationThresholdRuleCondition : RuleCondition + { + /// + /// Initializes a new instance of the LocationThresholdRuleCondition + /// class. + /// + public LocationThresholdRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LocationThresholdRuleCondition + /// class. + /// + /// the number of locations that must + /// fail to activate the alert. + /// the resource from which the rule collects + /// its data. For this type dataSource will always be of type + /// RuleMetricDataSource. + /// the period of time (in ISO 8601 duration + /// format) that is used to monitor alert activity based on the + /// threshold. If specified then it must be between 5 minutes and 1 + /// day. + public LocationThresholdRuleCondition(int failedLocationCount, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?)) + : base(dataSource) + { + WindowSize = windowSize; + FailedLocationCount = failedLocationCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the period of time (in ISO 8601 duration format) that + /// is used to monitor alert activity based on the threshold. If + /// specified then it must be between 5 minutes and 1 day. + /// + [JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize { get; set; } + + /// + /// Gets or sets the number of locations that must fail to activate the + /// alert. + /// + [JsonProperty(PropertyName = "failedLocationCount")] + public int FailedLocationCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FailedLocationCount < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FailedLocationCount", 0); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs new file mode 100644 index 000000000000..a709d9399b93 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs @@ -0,0 +1,138 @@ +// +// 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; + + /// + /// The log profile resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class LogProfileResource : Resource + { + /// + /// Initializes a new instance of the LogProfileResource class. + /// + public LogProfileResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogProfileResource class. + /// + /// Resource location + /// List of regions for which Activity Log + /// events should be stored or streamed. It is a comma separated list + /// of valid ARM locations including the 'global' location. + /// the categories of the logs. These + /// categories are created as is convenient to the user. Some values + /// are: 'Write', 'Delete', and/or 'Action.' + /// the retention policy for the events + /// in the log. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// the resource id of the storage + /// account to which you would like to send the Activity Log. + /// The service bus rule ID of the + /// service bus namespace in which you would like to have Event Hubs + /// created for streaming the Activity Log. The rule ID is of the + /// format: '{service bus resource ID}/authorizationrules/{key + /// name}'. + public LogProfileResource(string location, IList locations, IList categories, RetentionPolicy retentionPolicy, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) + : base(location, id, name, type, tags) + { + StorageAccountId = storageAccountId; + ServiceBusRuleId = serviceBusRuleId; + Locations = locations; + Categories = categories; + RetentionPolicy = retentionPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource id of the storage account to which you + /// would like to send the Activity Log. + /// + [JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Gets or sets the service bus rule ID of the service bus namespace + /// in which you would like to have Event Hubs created for streaming + /// the Activity Log. The rule ID is of the format: '{service bus + /// resource ID}/authorizationrules/{key name}'. + /// + [JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId { get; set; } + + /// + /// Gets or sets list of regions for which Activity Log events should + /// be stored or streamed. It is a comma separated list of valid ARM + /// locations including the 'global' location. + /// + [JsonProperty(PropertyName = "properties.locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets the categories of the logs. These categories are + /// created as is convenient to the user. Some values are: 'Write', + /// 'Delete', and/or 'Action.' + /// + [JsonProperty(PropertyName = "properties.categories")] + public IList Categories { get; set; } + + /// + /// Gets or sets the retention policy for the events in the log. + /// + [JsonProperty(PropertyName = "properties.retentionPolicy")] + public RetentionPolicy RetentionPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Locations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); + } + if (Categories == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); + } + if (RetentionPolicy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); + } + if (RetentionPolicy != null) + { + RetentionPolicy.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs new file mode 100644 index 000000000000..a3622df0b0ea --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs @@ -0,0 +1,139 @@ +// +// 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; + + /// + /// The log profile resource for patch operations. + /// + [Rest.Serialization.JsonTransformation] + public partial class LogProfileResourcePatch + { + /// + /// Initializes a new instance of the LogProfileResourcePatch class. + /// + public LogProfileResourcePatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogProfileResourcePatch class. + /// + /// List of regions for which Activity Log + /// events should be stored or streamed. It is a comma separated list + /// of valid ARM locations including the 'global' location. + /// the categories of the logs. These + /// categories are created as is convenient to the user. Some values + /// are: 'Write', 'Delete', and/or 'Action.' + /// the retention policy for the events + /// in the log. + /// Resource tags + /// the resource id of the storage + /// account to which you would like to send the Activity Log. + /// The service bus rule ID of the + /// service bus namespace in which you would like to have Event Hubs + /// created for streaming the Activity Log. The rule ID is of the + /// format: '{service bus resource ID}/authorizationrules/{key + /// name}'. + public LogProfileResourcePatch(IList locations, IList categories, RetentionPolicy retentionPolicy, IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) + { + Tags = tags; + StorageAccountId = storageAccountId; + ServiceBusRuleId = serviceBusRuleId; + Locations = locations; + Categories = categories; + RetentionPolicy = retentionPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource id of the storage account to which you + /// would like to send the Activity Log. + /// + [JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Gets or sets the service bus rule ID of the service bus namespace + /// in which you would like to have Event Hubs created for streaming + /// the Activity Log. The rule ID is of the format: '{service bus + /// resource ID}/authorizationrules/{key name}'. + /// + [JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId { get; set; } + + /// + /// Gets or sets list of regions for which Activity Log events should + /// be stored or streamed. It is a comma separated list of valid ARM + /// locations including the 'global' location. + /// + [JsonProperty(PropertyName = "properties.locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets the categories of the logs. These categories are + /// created as is convenient to the user. Some values are: 'Write', + /// 'Delete', and/or 'Action.' + /// + [JsonProperty(PropertyName = "properties.categories")] + public IList Categories { get; set; } + + /// + /// Gets or sets the retention policy for the events in the log. + /// + [JsonProperty(PropertyName = "properties.retentionPolicy")] + public RetentionPolicy RetentionPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Locations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); + } + if (Categories == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); + } + if (RetentionPolicy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); + } + if (RetentionPolicy != null) + { + RetentionPolicy.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs new file mode 100644 index 000000000000..fed0ef407cda --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs @@ -0,0 +1,89 @@ +// +// 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; + + /// + /// Part of MultiTenantDiagnosticSettings. Specifies the settings for a + /// particular log. + /// + public partial class LogSettings + { + /// + /// Initializes a new instance of the LogSettings class. + /// + public LogSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogSettings class. + /// + /// a value indicating whether this log is + /// enabled. + /// Name of a Diagnostic Log category for a + /// resource type this setting is applied to. To obtain the list of + /// Diagnostic Log categories for a resource, first perform a GET + /// diagnostic settings operation. + /// the retention policy for this + /// log. + public LogSettings(bool enabled, string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) + { + Category = category; + Enabled = enabled; + RetentionPolicy = retentionPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of a Diagnostic Log category for a resource type + /// this setting is applied to. To obtain the list of Diagnostic Log + /// categories for a resource, first perform a GET diagnostic settings + /// operation. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets a value indicating whether this log is enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the retention policy for this log. + /// + [JsonProperty(PropertyName = "retentionPolicy")] + public RetentionPolicy RetentionPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RetentionPolicy != null) + { + RetentionPolicy.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs new file mode 100644 index 000000000000..0e2b2b3efa68 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs @@ -0,0 +1,78 @@ +// +// 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; + + /// + /// How the data that is collected should be combined over time. + /// + public partial class ManagementEventAggregationCondition + { + /// + /// Initializes a new instance of the + /// ManagementEventAggregationCondition class. + /// + public ManagementEventAggregationCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagementEventAggregationCondition class. + /// + /// the condition operator. Possible + /// values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + /// 'LessThanOrEqual' + /// The threshold value that activates the + /// alert. + /// the period of time (in ISO 8601 duration + /// format) that is used to monitor alert activity based on the + /// threshold. If specified then it must be between 5 minutes and 1 + /// day. + public ManagementEventAggregationCondition(ConditionOperator? operatorProperty = default(ConditionOperator?), double? threshold = default(double?), System.TimeSpan? windowSize = default(System.TimeSpan?)) + { + OperatorProperty = operatorProperty; + Threshold = threshold; + WindowSize = windowSize; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the condition operator. Possible values include: + /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// + [JsonProperty(PropertyName = "operator")] + public ConditionOperator? OperatorProperty { get; set; } + + /// + /// Gets or sets the threshold value that activates the alert. + /// + [JsonProperty(PropertyName = "threshold")] + public double? Threshold { 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. If + /// specified then it must be between 5 minutes and 1 day. + /// + [JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs new file mode 100644 index 000000000000..4ede5a411148 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// A management event rule condition. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition")] + public partial class ManagementEventRuleCondition : RuleCondition + { + /// + /// Initializes a new instance of the ManagementEventRuleCondition + /// class. + /// + public ManagementEventRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagementEventRuleCondition + /// class. + /// + /// the resource from which the rule collects + /// its data. For this type dataSource will always be of type + /// RuleMetricDataSource. + /// How the data that is collected should be + /// combined over time and when the alert is activated. Note that for + /// management event alerts aggregation is optional – if it is not + /// provided then any event will cause the alert to activate. + public ManagementEventRuleCondition(RuleDataSource dataSource = default(RuleDataSource), ManagementEventAggregationCondition aggregation = default(ManagementEventAggregationCondition)) + : base(dataSource) + { + Aggregation = aggregation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets how the data that is collected should be combined over + /// time and when the alert is activated. Note that for management + /// event alerts aggregation is optional – if it is not provided then + /// any event will cause the alert to activate. + /// + [JsonProperty(PropertyName = "aggregation")] + public ManagementEventAggregationCondition Aggregation { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs new file mode 100644 index 000000000000..84b70cfdc04d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs @@ -0,0 +1,72 @@ +// +// 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; + + /// + /// Represents a metric metadata value. + /// + public partial class MetadataValue + { + /// + /// Initializes a new instance of the MetadataValue class. + /// + public MetadataValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataValue class. + /// + /// the name of the metadata. + /// the value of the metadata. + public MetadataValue(LocalizableString name = default(LocalizableString), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metadata. + /// + [JsonProperty(PropertyName = "name")] + public LocalizableString Name { get; set; } + + /// + /// Gets or sets the value of the metadata. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name != null) + { + Name.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs new file mode 100644 index 000000000000..003ddb21c4c0 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs @@ -0,0 +1,159 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The result data of a query. + /// + public partial class Metric + { + /// + /// Initializes a new instance of the Metric class. + /// + public Metric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Metric class. + /// + /// the metric Id. + /// the resource type of the metric + /// resource. + /// the name and the display name of the metric, + /// i.e. it is localizable string. + /// The unit of the metric. Possible values include: + /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', + /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// the time series returned when a data query + /// is performed. + /// Detailed description of this + /// metric. + /// 'Success' or the error details on query + /// failures for this metric. + /// Error message encountered querying this + /// specific metric. + public Metric(string id, string type, LocalizableString name, string unit, IList timeseries, string displayDescription = default(string), string errorCode = default(string), string errorMessage = default(string)) + { + Id = id; + Type = type; + Name = name; + DisplayDescription = displayDescription; + ErrorCode = errorCode; + ErrorMessage = errorMessage; + Unit = unit; + Timeseries = timeseries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the resource type of the metric resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name and the display name of the metric, i.e. it + /// is localizable string. + /// + [JsonProperty(PropertyName = "name")] + public LocalizableString Name { get; set; } + + /// + /// Gets or sets detailed description of this metric. + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets 'Success' or the error details on query failures for + /// this metric. + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; set; } + + /// + /// Gets or sets error message encountered querying this specific + /// metric. + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// Gets or sets the unit of the metric. Possible values include: + /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', + /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets the time series returned when a data query is + /// performed. + /// + [JsonProperty(PropertyName = "timeseries")] + public IList Timeseries { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Unit == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Unit"); + } + if (Timeseries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timeseries"); + } + if (Name != null) + { + Name.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs new file mode 100644 index 000000000000..34d8307f5947 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs @@ -0,0 +1,66 @@ +// +// 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; + + /// + /// An alert action. + /// + public partial class MetricAlertAction + { + /// + /// Initializes a new instance of the MetricAlertAction class. + /// + public MetricAlertAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertAction class. + /// + /// the id of the action group to + /// use. + /// 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; + WebHookProperties = webHookProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the action group to use. + /// + [JsonProperty(PropertyName = "actionGroupId")] + public string ActionGroupId { get; set; } + + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs new file mode 100644 index 000000000000..e5d00fa0cdee --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs @@ -0,0 +1,56 @@ +// +// 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 rule criteria that defines the conditions of the alert rule. + /// + [Newtonsoft.Json.JsonObject("MetricAlertCriteria")] + public partial class MetricAlertCriteria + { + /// + /// Initializes a new instance of the MetricAlertCriteria class. + /// + public MetricAlertCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertCriteria class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public MetricAlertCriteria(IDictionary additionalProperties = default(IDictionary)) + { + AdditionalProperties = additionalProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs new file mode 100644 index 000000000000..105d3f132ee8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the metric alert criteria for multiple resource that has + /// multiple metric criteria. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")] + public partial class MetricAlertMultipleResourceMultipleMetricCriteria : MetricAlertCriteria + { + /// + /// Initializes a new instance of the + /// MetricAlertMultipleResourceMultipleMetricCriteria class. + /// + public MetricAlertMultipleResourceMultipleMetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MetricAlertMultipleResourceMultipleMetricCriteria class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// the list of multiple metric criteria for this + /// 'all of' operation. + public MetricAlertMultipleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) + : base(additionalProperties) + { + AllOf = allOf; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of multiple metric criteria for this 'all of' + /// operation. + /// + [JsonProperty(PropertyName = "allOf")] + public IList AllOf { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs new file mode 100644 index 000000000000..f61516f319a7 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs @@ -0,0 +1,205 @@ +// +// 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; + + /// + /// The metric alert resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class MetricAlertResource : Resource + { + /// + /// Initializes a new instance of the MetricAlertResource class. + /// + public MetricAlertResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertResource class. + /// + /// Resource location + /// 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. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// 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 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 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 + /// the alert rule becomes active, and when an alert condition is + /// resolved. + /// Last time the rule was updated in + /// ISO8601 format. + /// 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?), bool? isMigrated = default(bool?)) + : base(location, id, name, type, tags) + { + Description = description; + Severity = severity; + Enabled = enabled; + Scopes = scopes; + EvaluationFrequency = evaluationFrequency; + WindowSize = windowSize; + TargetResourceType = targetResourceType; + TargetResourceRegion = targetResourceRegion; + Criteria = criteria; + AutoMitigate = autoMitigate; + Actions = actions; + LastUpdatedTime = lastUpdatedTime; + IsMigrated = isMigrated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the metric alert that will be + /// included in the alert email. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets alert severity {0, 1, 2, 3, 4} + /// + [JsonProperty(PropertyName = "properties.severity")] + 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; } + + /// + /// Gets or sets the list of resource id's that this metric alert is + /// scoped to. + /// + [JsonProperty(PropertyName = "properties.scopes")] + public IList Scopes { get; set; } + + /// + /// Gets or sets how often the metric alert is evaluated represented in + /// ISO 8601 duration format. + /// + [JsonProperty(PropertyName = "properties.evaluationFrequency")] + 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; } + + /// + /// Gets or sets the resource type of the target resource(s) on which + /// 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 if the scope contains a + /// subscription, resource group, or more than one resource. + /// + [JsonProperty(PropertyName = "properties.targetResourceRegion")] + public string TargetResourceRegion { get; set; } + + /// + /// Gets or sets defines the specific alert criteria information. + /// + [JsonProperty(PropertyName = "properties.criteria")] + public MetricAlertCriteria Criteria { get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert should be + /// auto resolved or not. The default is true. + /// + [JsonProperty(PropertyName = "properties.autoMitigate")] + public bool? AutoMitigate { get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert + /// rule becomes active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime { get; private set; } + + /// + /// Gets the value indicating whether this alert rule is migrated. + /// + [JsonProperty(PropertyName = "properties.isMigrated")] + public bool? IsMigrated { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Scopes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Scopes"); + } + if (Criteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs new file mode 100644 index 000000000000..79942cfb0c2b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs @@ -0,0 +1,187 @@ +// +// 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; + + /// + /// The metric alert resource for patch operations. + /// + [Rest.Serialization.JsonTransformation] + public partial class MetricAlertResourcePatch + { + /// + /// Initializes a new instance of the MetricAlertResourcePatch class. + /// + public MetricAlertResourcePatch() + { + CustomInit(); + } + + /// + /// 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. + /// 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 + /// the alert rule becomes active, and when an alert condition is + /// resolved. + /// Last time the rule was updated in + /// ISO8601 format. + /// 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?), bool? isMigrated = default(bool?)) + { + Tags = tags; + Description = description; + Severity = severity; + Enabled = enabled; + Scopes = scopes; + EvaluationFrequency = evaluationFrequency; + WindowSize = windowSize; + TargetResourceType = targetResourceType; + TargetResourceRegion = targetResourceRegion; + Criteria = criteria; + AutoMitigate = autoMitigate; + Actions = actions; + LastUpdatedTime = lastUpdatedTime; + IsMigrated = isMigrated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the description of the metric alert that will be + /// included in the alert email. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets alert severity {0, 1, 2, 3, 4} + /// + [JsonProperty(PropertyName = "properties.severity")] + 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; } + + /// + /// Gets or sets the list of resource id's that this metric alert is + /// scoped to. + /// + [JsonProperty(PropertyName = "properties.scopes")] + public IList Scopes { get; set; } + + /// + /// Gets or sets how often the metric alert is evaluated represented in + /// ISO 8601 duration format. + /// + [JsonProperty(PropertyName = "properties.evaluationFrequency")] + 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; } + + /// + /// Gets or sets the resource type of the target resource(s) on which + /// the alert is created/updated. Mandatory for + /// MultipleResourceMultipleMetricCriteria. + /// + [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. + /// + [JsonProperty(PropertyName = "properties.targetResourceRegion")] + public string TargetResourceRegion { get; set; } + + /// + /// Gets or sets defines the specific alert criteria information. + /// + [JsonProperty(PropertyName = "properties.criteria")] + public MetricAlertCriteria Criteria { get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert should be + /// auto resolved or not. The default is true. + /// + [JsonProperty(PropertyName = "properties.autoMitigate")] + public bool? AutoMitigate { get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert + /// rule becomes active, and when an alert condition is resolved. + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime { get; private set; } + + /// + /// Gets the value indicating whether this alert rule is migrated. + /// + [JsonProperty(PropertyName = "properties.isMigrated")] + public bool? IsMigrated { get; private set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs new file mode 100644 index 000000000000..bc38badfd4b5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the metric alert criteria for a single resource that has + /// multiple metric criteria. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria")] + public partial class MetricAlertSingleResourceMultipleMetricCriteria : MetricAlertCriteria + { + /// + /// Initializes a new instance of the + /// MetricAlertSingleResourceMultipleMetricCriteria class. + /// + public MetricAlertSingleResourceMultipleMetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MetricAlertSingleResourceMultipleMetricCriteria class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The list of metric criteria for this 'all of' + /// operation. + public MetricAlertSingleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) + : base(additionalProperties) + { + AllOf = allOf; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of metric criteria for this 'all of' + /// operation. + /// + [JsonProperty(PropertyName = "allOf")] + public IList AllOf { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs new file mode 100644 index 000000000000..f09809a7535e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An alert status. + /// + public partial class MetricAlertStatus + { + /// + /// Initializes a new instance of the MetricAlertStatus class. + /// + public MetricAlertStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertStatus class. + /// + /// The status name. + /// The alert rule arm id. + /// The extended resource type name. + /// The alert status properties of the metric + /// alert status. + public MetricAlertStatus(string name = default(string), string id = default(string), string type = default(string), MetricAlertStatusProperties properties = default(MetricAlertStatusProperties)) + { + Name = name; + Id = id; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the alert rule arm id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the extended resource type name. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the alert status properties of the metric alert + /// status. + /// + [JsonProperty(PropertyName = "properties")] + public MetricAlertStatusProperties Properties { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs new file mode 100644 index 000000000000..461d2b441d0b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs @@ -0,0 +1,56 @@ +// +// 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; + + /// + /// Represents a collection of alert rule resources. + /// + public partial class MetricAlertStatusCollection + { + /// + /// Initializes a new instance of the MetricAlertStatusCollection + /// class. + /// + public MetricAlertStatusCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertStatusCollection + /// class. + /// + /// the values for the alert rule + /// resources. + public MetricAlertStatusCollection(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the values for the alert rule resources. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs new file mode 100644 index 000000000000..ba3dedbad37d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs @@ -0,0 +1,73 @@ +// +// 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; + + /// + /// An alert status properties. + /// + public partial class MetricAlertStatusProperties + { + /// + /// Initializes a new instance of the MetricAlertStatusProperties + /// class. + /// + public MetricAlertStatusProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertStatusProperties + /// class. + /// + /// An object describing the type of the + /// dimensions. + /// status value + /// UTC time when the status was + /// checked. + public MetricAlertStatusProperties(IDictionary dimensions = default(IDictionary), string status = default(string), System.DateTime? timestamp = default(System.DateTime?)) + { + Dimensions = dimensions; + Status = status; + Timestamp = timestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an object describing the type of the dimensions. + /// + [JsonProperty(PropertyName = "dimensions")] + public IDictionary Dimensions { get; set; } + + /// + /// Gets or sets status value + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets UTC time when the status was checked. + /// + [JsonProperty(PropertyName = "timestamp")] + public System.DateTime? Timestamp { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs new file mode 100644 index 000000000000..c60ef65fd5e1 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metric availability specifies the time grain (aggregation interval or + /// frequency) and the retention period for that time grain. + /// + public partial class MetricAvailability + { + /// + /// Initializes a new instance of the MetricAvailability class. + /// + public MetricAvailability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAvailability class. + /// + /// the time grain specifies the aggregation + /// interval for the metric. Expressed as a duration 'PT1M', 'P1D', + /// etc. + /// the retention period for the metric at the + /// specified timegrain. Expressed as a duration 'PT1M', 'P1D', + /// etc. + public MetricAvailability(System.TimeSpan? timeGrain = default(System.TimeSpan?), System.TimeSpan? retention = default(System.TimeSpan?)) + { + TimeGrain = timeGrain; + Retention = retention; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time grain specifies the aggregation interval for + /// the metric. Expressed as a duration 'PT1M', 'P1D', etc. + /// + [JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan? TimeGrain { get; set; } + + /// + /// Gets or sets the retention period for the metric at the specified + /// timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + /// + [JsonProperty(PropertyName = "retention")] + public System.TimeSpan? Retention { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs new file mode 100644 index 000000000000..378581566094 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.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 MetricClass. + /// + public static class MetricClass + { + public const string Availability = "Availability"; + public const string Transactions = "Transactions"; + public const string Errors = "Errors"; + public const string Latency = "Latency"; + public const string Saturation = "Saturation"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs new file mode 100644 index 000000000000..99e60d8084f0 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Criterion to filter metrics. + /// + [Newtonsoft.Json.JsonObject("StaticThresholdCriterion")] + public partial class MetricCriteria : MultiMetricCriteria + { + /// + /// Initializes a new instance of the MetricCriteria class. + /// + public MetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricCriteria class. + /// + /// Name of the criteria. + /// Name of the metric. + /// the criteria time aggregation types. + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' + /// the criteria operator. Possible + /// values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', + /// 'LessThan', 'LessThanOrEqual' + /// the criteria threshold value that activates + /// the alert. + /// Unmatched properties from the + /// message are deserialized this collection + /// Namespace of the metric. + /// List of dimension conditions. + /// 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, 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; + Threshold = threshold; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the criteria operator. Possible values include: + /// 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + /// 'LessThanOrEqual' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets the criteria threshold value that activates the alert. + /// + [JsonProperty(PropertyName = "threshold")] + public double Threshold { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs new file mode 100644 index 000000000000..84d38c86e0b4 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs @@ -0,0 +1,201 @@ +// +// 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; + + /// + /// Metric definition class specifies the metadata for a metric. + /// + public partial class MetricDefinition + { + /// + /// Initializes a new instance of the MetricDefinition class. + /// + public MetricDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDefinition class. + /// + /// Flag to indicate whether the + /// dimension is required. + /// the resource identifier of the resource + /// that emitted the metric. + /// the namespace the metric belongs + /// to. + /// the name and the display name of the metric, + /// i.e. it is a localizable string. + /// Detailed description of this + /// metric. + /// Custom category name for this + /// metric. + /// The class of the metric. Possible values + /// include: 'Availability', 'Transactions', 'Errors', 'Latency', + /// 'Saturation' + /// The unit of the metric. Possible values include: + /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', + /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// the primary aggregation type + /// value defining how to use the values for display. Possible values + /// include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' + /// the collection of what + /// aggregation types are supported. + /// the collection of what + /// aggregation intervals are available to be queried. + /// the resource identifier of the metric + /// definition. + /// the name and the display name of the + /// dimension, i.e. it is a localizable string. + public MetricDefinition(bool? isDimensionRequired = default(bool?), string resourceId = default(string), string namespaceProperty = default(string), LocalizableString name = default(LocalizableString), string displayDescription = default(string), string category = default(string), string metricClass = default(string), string unit = default(string), AggregationType? primaryAggregationType = default(AggregationType?), IList supportedAggregationTypes = default(IList), IList metricAvailabilities = default(IList), string id = default(string), IList dimensions = default(IList)) + { + IsDimensionRequired = isDimensionRequired; + ResourceId = resourceId; + NamespaceProperty = namespaceProperty; + Name = name; + DisplayDescription = displayDescription; + Category = category; + MetricClass = metricClass; + Unit = unit; + PrimaryAggregationType = primaryAggregationType; + SupportedAggregationTypes = supportedAggregationTypes; + MetricAvailabilities = metricAvailabilities; + Id = id; + Dimensions = dimensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets flag to indicate whether the dimension is required. + /// + [JsonProperty(PropertyName = "isDimensionRequired")] + public bool? IsDimensionRequired { get; set; } + + /// + /// Gets or sets the resource identifier of the resource that emitted + /// the metric. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the namespace the metric belongs to. + /// + [JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty { get; set; } + + /// + /// Gets or sets the name and the display name of the metric, i.e. it + /// is a localizable string. + /// + [JsonProperty(PropertyName = "name")] + public LocalizableString Name { get; set; } + + /// + /// Gets or sets detailed description of this metric. + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets custom category name for this metric. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets the class of the metric. Possible values include: + /// 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + /// + [JsonProperty(PropertyName = "metricClass")] + public string MetricClass { get; set; } + + /// + /// Gets or sets the unit of the metric. Possible values include: + /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', + /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets the primary aggregation type value defining how to use + /// the values for display. Possible values include: 'None', 'Average', + /// 'Count', 'Minimum', 'Maximum', 'Total' + /// + [JsonProperty(PropertyName = "primaryAggregationType")] + public AggregationType? PrimaryAggregationType { get; set; } + + /// + /// Gets or sets the collection of what aggregation types are + /// supported. + /// + [JsonProperty(PropertyName = "supportedAggregationTypes")] + public IList SupportedAggregationTypes { get; set; } + + /// + /// Gets or sets the collection of what aggregation intervals are + /// available to be queried. + /// + [JsonProperty(PropertyName = "metricAvailabilities")] + public IList MetricAvailabilities { get; set; } + + /// + /// Gets or sets the resource identifier of the metric definition. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the name and the display name of the dimension, i.e. + /// it is a localizable string. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name != null) + { + Name.Validate(); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs new file mode 100644 index 000000000000..89e83546e09f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a metric dimension. + /// + public partial class MetricDimension + { + /// + /// Initializes a new instance of the MetricDimension class. + /// + public MetricDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDimension class. + /// + /// Name of the dimension. + /// the dimension operator. Only + /// 'Include' and 'Exclude' are supported + /// list of dimension values. + public MetricDimension(string name, string operatorProperty, IList values) + { + Name = name; + OperatorProperty = operatorProperty; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the dimension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the dimension operator. Only 'Include' and 'Exclude' + /// are supported + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets list of dimension values. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs new file mode 100644 index 000000000000..4cfc95c792a5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metric namespace class specifies the metadata for a metric namespace. + /// + public partial class MetricNamespace + { + /// + /// Initializes a new instance of the MetricNamespace class. + /// + public MetricNamespace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricNamespace class. + /// + /// The ID of the metric namespace. + /// The type of the namespace. + /// The escaped name of the namespace. + /// Kind of namespace. Possible values + /// include: 'Platform', 'Custom', 'Qos' + /// Properties which include the fully + /// qualified namespace name. + public MetricNamespace(string id = default(string), string type = default(string), string name = default(string), string classification = default(string), MetricNamespaceName properties = default(MetricNamespaceName)) + { + Id = id; + Type = type; + Name = name; + Classification = classification; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID of the metric namespace. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the type of the namespace. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the escaped name of the namespace. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets kind of namespace. Possible values include: + /// 'Platform', 'Custom', 'Qos' + /// + [JsonProperty(PropertyName = "classification")] + public string Classification { get; set; } + + /// + /// Gets or sets properties which include the fully qualified namespace + /// name. + /// + [JsonProperty(PropertyName = "properties")] + public MetricNamespaceName Properties { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs new file mode 100644 index 000000000000..1415eb1300a4 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The fully qualified metric namespace name. + /// + public partial class MetricNamespaceName + { + /// + /// Initializes a new instance of the MetricNamespaceName class. + /// + public MetricNamespaceName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricNamespaceName class. + /// + /// The metric namespace + /// name. + public MetricNamespaceName(string metricNamespaceNameProperty = default(string)) + { + MetricNamespaceNameProperty = metricNamespaceNameProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric namespace name. + /// + [JsonProperty(PropertyName = "metricNamespaceName")] + public string MetricNamespaceNameProperty { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs new file mode 100644 index 000000000000..bf7657b2a3b8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs @@ -0,0 +1,98 @@ +// +// 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; + + /// + /// Part of MultiTenantDiagnosticSettings. Specifies the settings for a + /// particular metric. + /// + public partial class MetricSettings + { + /// + /// Initializes a new instance of the MetricSettings class. + /// + public MetricSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSettings class. + /// + /// a value indicating whether this category is + /// enabled. + /// the timegrain of the metric in ISO8601 + /// format. + /// Name of a Diagnostic Metric category for a + /// resource type this setting is applied to. To obtain the list of + /// Diagnostic metric categories for a resource, first perform a GET + /// diagnostic settings operation. + /// the retention policy for this + /// category. + public MetricSettings(bool enabled, System.TimeSpan? timeGrain = default(System.TimeSpan?), string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) + { + TimeGrain = timeGrain; + Category = category; + Enabled = enabled; + RetentionPolicy = retentionPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timegrain of the metric in ISO8601 format. + /// + [JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan? TimeGrain { get; set; } + + /// + /// Gets or sets name of a Diagnostic Metric category for a resource + /// type this setting is applied to. To obtain the list of Diagnostic + /// metric categories for a resource, first perform a GET diagnostic + /// settings operation. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets a value indicating whether this category is enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the retention policy for this category. + /// + [JsonProperty(PropertyName = "retentionPolicy")] + public RetentionPolicy RetentionPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RetentionPolicy != null) + { + RetentionPolicy.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs new file mode 100644 index 000000000000..b80789586206 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The metric dimension name and value. + /// + public partial class MetricSingleDimension + { + /// + /// Initializes a new instance of the MetricSingleDimension class. + /// + public MetricSingleDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSingleDimension class. + /// + /// Name of the dimension. + /// Value of the dimension. + public MetricSingleDimension(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the dimension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets value of the dimension. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs new file mode 100644 index 000000000000..241b24be5fe9 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs @@ -0,0 +1,78 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MetricStatisticType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MetricStatisticType + { + [EnumMember(Value = "Average")] + Average, + [EnumMember(Value = "Min")] + Min, + [EnumMember(Value = "Max")] + Max, + [EnumMember(Value = "Sum")] + Sum, + [EnumMember(Value = "Count")] + Count + } + internal static class MetricStatisticTypeEnumExtension + { + internal static string ToSerializedValue(this MetricStatisticType? value) + { + return value == null ? null : ((MetricStatisticType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MetricStatisticType value) + { + switch( value ) + { + case MetricStatisticType.Average: + return "Average"; + case MetricStatisticType.Min: + return "Min"; + case MetricStatisticType.Max: + return "Max"; + case MetricStatisticType.Sum: + return "Sum"; + case MetricStatisticType.Count: + return "Count"; + } + return null; + } + + internal static MetricStatisticType? ParseMetricStatisticType(this string value) + { + switch( value ) + { + case "Average": + return MetricStatisticType.Average; + case "Min": + return MetricStatisticType.Min; + case "Max": + return MetricStatisticType.Max; + case "Sum": + return MetricStatisticType.Sum; + case "Count": + return MetricStatisticType.Count; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs new file mode 100644 index 000000000000..dc19e4db4a29 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs @@ -0,0 +1,208 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The trigger that results in a scaling action. + /// + public partial class MetricTrigger + { + /// + /// Initializes a new instance of the MetricTrigger class. + /// + public MetricTrigger() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricTrigger class. + /// + /// the name of the metric that defines what + /// the rule monitors. + /// the resource identifier of the + /// resource the rule monitors. + /// the granularity of metrics the rule + /// monitors. Must be one of the predefined values returned from metric + /// definitions for the metric. Must be between 12 hours and 1 + /// minute. + /// the metric statistic type. How the metrics + /// from multiple instances are combined. Possible values include: + /// 'Average', 'Min', 'Max', 'Sum', 'Count' + /// the range of time in which instance data + /// is collected. This value must be greater than the delay in metric + /// collection, which can vary from resource-to-resource. Must be + /// between 12 hours and 5 minutes. + /// time aggregation type. How the data + /// that is collected should be combined over time. The default value + /// is Average. Possible values include: 'Average', 'Minimum', + /// 'Maximum', 'Total', 'Count', 'Last' + /// the operator that is used to compare + /// the metric data and the threshold. Possible values include: + /// 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', + /// 'LessThan', 'LessThanOrEqual' + /// the threshold of the metric that triggers + /// the scale action. + /// the namespace of the metric that + /// defines what the rule monitors. + /// the location of the resource + /// the rule monitors. + /// List of dimension conditions. For example: + /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + /// a value indicating whether metric + /// should divide per instance. + public MetricTrigger(string metricName, string metricResourceUri, System.TimeSpan timeGrain, MetricStatisticType statistic, System.TimeSpan timeWindow, TimeAggregationType timeAggregation, ComparisonOperationType operatorProperty, double threshold, string metricNamespace = default(string), string metricResourceLocation = default(string), IList dimensions = default(IList), bool? dividePerInstance = default(bool?)) + { + MetricName = metricName; + MetricNamespace = metricNamespace; + MetricResourceUri = metricResourceUri; + MetricResourceLocation = metricResourceLocation; + TimeGrain = timeGrain; + Statistic = statistic; + TimeWindow = timeWindow; + TimeAggregation = timeAggregation; + OperatorProperty = operatorProperty; + Threshold = threshold; + Dimensions = dimensions; + DividePerInstance = dividePerInstance; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metric that defines what the rule + /// monitors. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets the namespace of the metric that defines what the rule + /// monitors. + /// + [JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace { get; set; } + + /// + /// Gets or sets the resource identifier of the resource the rule + /// monitors. + /// + [JsonProperty(PropertyName = "metricResourceUri")] + public string MetricResourceUri { get; set; } + + /// + /// Gets or sets the location of the resource the rule monitors. + /// + [JsonProperty(PropertyName = "metricResourceLocation")] + public string MetricResourceLocation { get; set; } + + /// + /// Gets or sets the granularity of metrics the rule monitors. Must be + /// one of the predefined values returned from metric definitions for + /// the metric. Must be between 12 hours and 1 minute. + /// + [JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan TimeGrain { get; set; } + + /// + /// Gets or sets the metric statistic type. How the metrics from + /// multiple instances are combined. Possible values include: + /// 'Average', 'Min', 'Max', 'Sum', 'Count' + /// + [JsonProperty(PropertyName = "statistic")] + public MetricStatisticType Statistic { get; set; } + + /// + /// Gets or sets the range of time in which instance data is collected. + /// This value must be greater than the delay in metric collection, + /// which can vary from resource-to-resource. Must be between 12 hours + /// and 5 minutes. + /// + [JsonProperty(PropertyName = "timeWindow")] + public System.TimeSpan TimeWindow { get; set; } + + /// + /// Gets or sets time aggregation type. How the data that is collected + /// should be combined over time. The default value is Average. + /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', + /// 'Count', 'Last' + /// + [JsonProperty(PropertyName = "timeAggregation")] + public TimeAggregationType TimeAggregation { get; set; } + + /// + /// Gets or sets the operator that is used to compare the metric data + /// and the threshold. Possible values include: 'Equals', 'NotEquals', + /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// + [JsonProperty(PropertyName = "operator")] + public ComparisonOperationType OperatorProperty { get; set; } + + /// + /// Gets or sets the threshold of the metric that triggers the scale + /// action. + /// + [JsonProperty(PropertyName = "threshold")] + public double Threshold { get; set; } + + /// + /// Gets or sets list of dimension conditions. For example: + /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets a value indicating whether metric should divide per + /// instance. + /// + [JsonProperty(PropertyName = "dividePerInstance")] + public bool? DividePerInstance { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (MetricResourceUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricResourceUri"); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs new file mode 100644 index 000000000000..b1233d95500c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs @@ -0,0 +1,33 @@ +// +// 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 MetricUnit. + /// + public static class MetricUnit + { + public const string Count = "Count"; + public const string Bytes = "Bytes"; + public const string Seconds = "Seconds"; + public const string CountPerSecond = "CountPerSecond"; + public const string BytesPerSecond = "BytesPerSecond"; + public const string Percent = "Percent"; + public const string MilliSeconds = "MilliSeconds"; + public const string ByteSeconds = "ByteSeconds"; + public const string Unspecified = "Unspecified"; + public const string Cores = "Cores"; + public const string MilliCores = "MilliCores"; + public const string NanoCores = "NanoCores"; + public const string BitsPerSecond = "BitsPerSecond"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs new file mode 100644 index 000000000000..01180a7f2634 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs @@ -0,0 +1,107 @@ +// +// 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; + + /// + /// Represents a metric value. + /// + public partial class MetricValue + { + /// + /// Initializes a new instance of the MetricValue class. + /// + public MetricValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricValue class. + /// + /// the timestamp for the metric value in ISO + /// 8601 format. + /// the average value in the time range. + /// the least value in the time range. + /// the greatest value in the time range. + /// the sum of all of the values in the time + /// range. + /// the number of samples in the time range. Can be + /// used to determine the number of values that contributed to the + /// average value. + public MetricValue(System.DateTime timeStamp, double? average = default(double?), double? minimum = default(double?), double? maximum = default(double?), double? total = default(double?), double? count = default(double?)) + { + TimeStamp = timeStamp; + Average = average; + Minimum = minimum; + Maximum = maximum; + Total = total; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timestamp for the metric value in ISO 8601 format. + /// + [JsonProperty(PropertyName = "timeStamp")] + public System.DateTime TimeStamp { get; set; } + + /// + /// Gets or sets the average value in the time range. + /// + [JsonProperty(PropertyName = "average")] + public double? Average { get; set; } + + /// + /// Gets or sets the least value in the time range. + /// + [JsonProperty(PropertyName = "minimum")] + public double? Minimum { get; set; } + + /// + /// Gets or sets the greatest value in the time range. + /// + [JsonProperty(PropertyName = "maximum")] + public double? Maximum { get; set; } + + /// + /// Gets or sets the sum of all of the values in the time range. + /// + [JsonProperty(PropertyName = "total")] + public double? Total { get; set; } + + /// + /// Gets or sets the number of samples in the time range. Can be used + /// to determine the number of values that contributed to the average + /// value. + /// + [JsonProperty(PropertyName = "count")] + public double? Count { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs new file mode 100644 index 000000000000..ed17c02e18d6 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs @@ -0,0 +1,142 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The types of conditions for a multi resource alert. + /// + [Newtonsoft.Json.JsonObject("MultiMetricCriteria")] + public partial class MultiMetricCriteria + { + /// + /// Initializes a new instance of the MultiMetricCriteria class. + /// + public MultiMetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MultiMetricCriteria class. + /// + /// Name of the criteria. + /// Name of the metric. + /// 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. + /// List of dimension conditions. + /// 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, string timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) + { + AdditionalProperties = additionalProperties; + Name = name; + MetricName = metricName; + MetricNamespace = metricNamespace; + TimeAggregation = timeAggregation; + Dimensions = dimensions; + SkipMetricValidation = skipMetricValidation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets or sets name of the criteria. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets name of the metric. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets namespace of the metric. + /// + [JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace { get; set; } + + /// + /// Gets or sets the criteria time aggregation types. Possible values + /// include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + /// + [JsonProperty(PropertyName = "timeAggregation")] + public string TimeAggregation { get; set; } + + /// + /// Gets or sets list of dimension conditions. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets allows creating an alert rule on a custom metric that + /// isn't yet emitted, by causing the metric validation to be skipped. + /// + [JsonProperty(PropertyName = "skipMetricValidation")] + public bool? SkipMetricValidation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (TimeAggregation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeAggregation"); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs new file mode 100644 index 000000000000..cf9e86b28491 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for NamespaceClassification. + /// + public static class NamespaceClassification + { + public const string Platform = "Platform"; + public const string Custom = "Custom"; + public const string Qos = "Qos"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs new file mode 100644 index 000000000000..083acf983694 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs @@ -0,0 +1,94 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs new file mode 100644 index 000000000000..f17a6d3c7801 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.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 OperatorModel. + /// + public static class OperatorModel + { + public const string Equals = "Equals"; + public const string GreaterThan = "GreaterThan"; + public const string GreaterThanOrEqual = "GreaterThanOrEqual"; + public const string LessThan = "LessThan"; + public const string LessThanOrEqual = "LessThanOrEqual"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..f13b6312d35f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs new file mode 100644 index 000000000000..8eb5b9de7c3e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..92815fd0af43 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,90 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs new file mode 100644 index 000000000000..58ffe77bb549 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.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/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..7c2dae65de48 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.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/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs new file mode 100644 index 000000000000..ef895d380760 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs @@ -0,0 +1,100 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs new file mode 100644 index 000000000000..887acba7f23a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -0,0 +1,90 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs new file mode 100644 index 000000000000..cd2757f49843 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A proxy only azure resource object + /// + public partial class ProxyOnlyResource : IResource + { + /// + /// Initializes a new instance of the ProxyOnlyResource class. + /// + public ProxyOnlyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyOnlyResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public ProxyOnlyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..18a5c4e49cde --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs new file mode 100644 index 000000000000..040810a5ece6 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The repeating times at which this profile begins. This element is not + /// used if the FixedDate element is used. + /// + public partial class Recurrence + { + /// + /// Initializes a new instance of the Recurrence class. + /// + public Recurrence() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Recurrence class. + /// + /// the recurrence frequency. How often the + /// schedule profile should take effect. This value must be Week, + /// meaning each week will have the same set of profiles. For example, + /// to set a daily schedule, set **schedule** to every day of the week. + /// The frequency property specifies that the schedule is repeated + /// weekly. Possible values include: 'None', 'Second', 'Minute', + /// 'Hour', 'Day', 'Week', 'Month', 'Year' + /// the scheduling constraints for when the + /// profile begins. + public Recurrence(RecurrenceFrequency frequency, RecurrentSchedule schedule) + { + Frequency = frequency; + Schedule = schedule; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recurrence frequency. How often the schedule + /// profile should take effect. This value must be Week, meaning each + /// week will have the same set of profiles. For example, to set a + /// daily schedule, set **schedule** to every day of the week. The + /// frequency property specifies that the schedule is repeated weekly. + /// Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', + /// 'Week', 'Month', 'Year' + /// + [JsonProperty(PropertyName = "frequency")] + public RecurrenceFrequency Frequency { get; set; } + + /// + /// Gets or sets the scheduling constraints for when the profile + /// begins. + /// + [JsonProperty(PropertyName = "schedule")] + public RecurrentSchedule Schedule { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); + } + if (Schedule != null) + { + Schedule.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs new file mode 100644 index 000000000000..27b48299752a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs @@ -0,0 +1,96 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecurrenceFrequency. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecurrenceFrequency + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Second")] + Second, + [EnumMember(Value = "Minute")] + Minute, + [EnumMember(Value = "Hour")] + Hour, + [EnumMember(Value = "Day")] + Day, + [EnumMember(Value = "Week")] + Week, + [EnumMember(Value = "Month")] + Month, + [EnumMember(Value = "Year")] + Year + } + internal static class RecurrenceFrequencyEnumExtension + { + internal static string ToSerializedValue(this RecurrenceFrequency? value) + { + return value == null ? null : ((RecurrenceFrequency)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecurrenceFrequency value) + { + switch( value ) + { + case RecurrenceFrequency.None: + return "None"; + case RecurrenceFrequency.Second: + return "Second"; + case RecurrenceFrequency.Minute: + return "Minute"; + case RecurrenceFrequency.Hour: + return "Hour"; + case RecurrenceFrequency.Day: + return "Day"; + case RecurrenceFrequency.Week: + return "Week"; + case RecurrenceFrequency.Month: + return "Month"; + case RecurrenceFrequency.Year: + return "Year"; + } + return null; + } + + internal static RecurrenceFrequency? ParseRecurrenceFrequency(this string value) + { + switch( value ) + { + case "None": + return RecurrenceFrequency.None; + case "Second": + return RecurrenceFrequency.Second; + case "Minute": + return RecurrenceFrequency.Minute; + case "Hour": + return RecurrenceFrequency.Hour; + case "Day": + return RecurrenceFrequency.Day; + case "Week": + return RecurrenceFrequency.Week; + case "Month": + return RecurrenceFrequency.Month; + case "Year": + return RecurrenceFrequency.Year; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs new file mode 100644 index 000000000000..5003472be503 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs @@ -0,0 +1,194 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The scheduling constraints for when the profile begins. + /// + public partial class RecurrentSchedule + { + /// + /// Initializes a new instance of the RecurrentSchedule class. + /// + public RecurrentSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecurrentSchedule class. + /// + /// the timezone for the hours of the profile. + /// Some examples of valid time zones are: Dateline Standard Time, + /// UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific + /// Standard Time (Mexico), Pacific Standard Time, US Mountain Standard + /// Time, Mountain Standard Time (Mexico), Mountain Standard Time, + /// Central America Standard Time, Central Standard Time, Central + /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific + /// Standard Time, Eastern Standard Time, US Eastern Standard Time, + /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard + /// Time, Central Brazilian Standard Time, SA Western Standard Time, + /// Pacific SA Standard Time, Newfoundland Standard Time, E. South + /// America Standard Time, Argentina Standard Time, SA Eastern Standard + /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia + /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard + /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT + /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, + /// Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia + /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East + /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe + /// Standard Time, South Africa Standard Time, FLE Standard Time, + /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard + /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard + /// Time, Belarus Standard Time, Russian Standard Time, E. Africa + /// Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard + /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan + /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, + /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard + /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh + /// Standard Time, N. Central Asia Standard Time, Myanmar Standard + /// Time, SE Asia Standard Time, North Asia Standard Time, China + /// Standard Time, North Asia East Standard Time, Singapore Standard + /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar + /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk + /// Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West + /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard + /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central + /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + /// Standard Time, Samoa Standard Time, Line Islands Standard + /// Time + /// the collection of days that the profile takes + /// effect on. Possible values are Sunday through Saturday. + /// A collection of hours that the profile takes + /// effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM + /// times are not supported). + /// A collection of minutes at which the profile + /// takes effect at. + public RecurrentSchedule(string timeZone, IList days, IList hours, IList minutes) + { + TimeZone = timeZone; + Days = days; + Hours = hours; + Minutes = minutes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timezone for the hours of the profile. Some + /// examples of valid time zones are: Dateline Standard Time, UTC-11, + /// Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard + /// Time (Mexico), Pacific Standard Time, US Mountain Standard Time, + /// Mountain Standard Time (Mexico), Mountain Standard Time, Central + /// America Standard Time, Central Standard Time, Central Standard Time + /// (Mexico), Canada Central Standard Time, SA Pacific Standard Time, + /// Eastern Standard Time, US Eastern Standard Time, Venezuela Standard + /// Time, Paraguay Standard Time, Atlantic Standard Time, Central + /// Brazilian Standard Time, SA Western Standard Time, Pacific SA + /// Standard Time, Newfoundland Standard Time, E. South America + /// Standard Time, Argentina Standard Time, SA Eastern Standard Time, + /// Greenland Standard Time, Montevideo Standard Time, Bahia Standard + /// Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, + /// Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard + /// Time, Greenwich Standard Time, W. Europe Standard Time, Central + /// Europe Standard Time, Romance Standard Time, Central European + /// Standard Time, W. Central Africa Standard Time, Namibia Standard + /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + /// Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard + /// Time, South Africa Standard Time, FLE Standard Time, Turkey + /// Standard Time, Israel Standard Time, Kaliningrad Standard Time, + /// Libya Standard Time, Arabic Standard Time, Arab Standard Time, + /// Belarus Standard Time, Russian Standard Time, E. Africa Standard + /// Time, Iran Standard Time, Arabian Standard Time, Azerbaijan + /// Standard Time, Russia Time Zone 3, Mauritius Standard Time, + /// Georgian Standard Time, Caucasus Standard Time, Afghanistan + /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, + /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard + /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh + /// Standard Time, N. Central Asia Standard Time, Myanmar Standard + /// Time, SE Asia Standard Time, North Asia Standard Time, China + /// Standard Time, North Asia East Standard Time, Singapore Standard + /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar + /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk + /// Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West + /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard + /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central + /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + /// Standard Time, Samoa Standard Time, Line Islands Standard Time + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets the collection of days that the profile takes effect + /// on. Possible values are Sunday through Saturday. + /// + [JsonProperty(PropertyName = "days")] + public IList Days { get; set; } + + /// + /// Gets or sets a collection of hours that the profile takes effect + /// on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times + /// are not supported). + /// + [JsonProperty(PropertyName = "hours")] + public IList Hours { get; set; } + + /// + /// Gets or sets a collection of minutes at which the profile takes + /// effect at. + /// + [JsonProperty(PropertyName = "minutes")] + public IList Minutes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TimeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeZone"); + } + if (Days == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Days"); + } + if (Hours == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Hours"); + } + if (Minutes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Minutes"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..d3ccce82751b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,100 @@ +// +// 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 Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource location + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + public Resource(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/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs new file mode 100644 index 000000000000..828d2ec23b0d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response to a metrics query. + /// + public partial class Response + { + /// + /// Initializes a new instance of the Response class. + /// + public Response() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Response class. + /// + /// The timespan for which the data was + /// retrieved. Its value consists of two datetimes concatenated, + /// separated by '/'. This may be adjusted in the future and returned + /// back from what was originally requested. + /// the value of the collection. + /// The integer value representing the relative cost + /// of the query. + /// The interval (window size) for which the + /// metric data was returned in. This may be adjusted in the future + /// and returned back from what was originally requested. This is not + /// present if a metadata request was made. + /// The namespace of the metrics being + /// queried + /// The region of the resource being + /// queried for metrics. + public Response(string timespan, IList value, double? cost = default(double?), System.TimeSpan? interval = default(System.TimeSpan?), string namespaceProperty = default(string), string resourceregion = default(string)) + { + Cost = cost; + Timespan = timespan; + Interval = interval; + NamespaceProperty = namespaceProperty; + Resourceregion = resourceregion; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the integer value representing the relative cost of + /// the query. + /// + [JsonProperty(PropertyName = "cost")] + public double? Cost { get; set; } + + /// + /// Gets or sets the timespan for which the data was retrieved. Its + /// value consists of two datetimes concatenated, separated by '/'. + /// This may be adjusted in the future and returned back from what was + /// originally requested. + /// + [JsonProperty(PropertyName = "timespan")] + public string Timespan { get; set; } + + /// + /// Gets or sets the interval (window size) for which the metric data + /// was returned in. This may be adjusted in the future and returned + /// back from what was originally requested. This is not present if a + /// metadata request was made. + /// + [JsonProperty(PropertyName = "interval")] + public System.TimeSpan? Interval { get; set; } + + /// + /// Gets or sets the namespace of the metrics being queried + /// + [JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty { get; set; } + + /// + /// Gets or sets the region of the resource being queried for metrics. + /// + [JsonProperty(PropertyName = "resourceregion")] + public string Resourceregion { get; set; } + + /// + /// Gets or sets the value of the collection. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Timespan == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (Cost != null) + { + if (Cost < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Cost", 0); + } + } + if (Value != null) + { + foreach (var element in Value) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs new file mode 100644 index 000000000000..d0133162a521 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs @@ -0,0 +1,60 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResultType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResultType + { + [EnumMember(Value = "Data")] + Data, + [EnumMember(Value = "Metadata")] + Metadata + } + internal static class ResultTypeEnumExtension + { + internal static string ToSerializedValue(this ResultType? value) + { + return value == null ? null : ((ResultType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResultType value) + { + switch( value ) + { + case ResultType.Data: + return "Data"; + case ResultType.Metadata: + return "Metadata"; + } + return null; + } + + internal static ResultType? ParseResultType(this string value) + { + switch( value ) + { + case "Data": + return ResultType.Data; + case "Metadata": + return ResultType.Metadata; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs new file mode 100644 index 000000000000..683b0b6aa07a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the retention policy for the log. + /// + public partial class RetentionPolicy + { + /// + /// Initializes a new instance of the RetentionPolicy class. + /// + public RetentionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetentionPolicy class. + /// + /// a value indicating whether the retention + /// policy is enabled. + /// the number of days for the retention in days. A + /// value of 0 will retain the events indefinitely. + public RetentionPolicy(bool enabled, int days) + { + Enabled = enabled; + Days = days; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a value indicating whether the retention policy is + /// enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the number of days for the retention in days. A value + /// of 0 will retain the events indefinitely. + /// + [JsonProperty(PropertyName = "days")] + public int Days { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Days < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Days", 0); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs new file mode 100644 index 000000000000..477a7bd77c29 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs @@ -0,0 +1,38 @@ +// +// 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 action that is performed when the alert rule becomes active, and + /// when an alert condition is resolved. + /// + [Newtonsoft.Json.JsonObject("RuleAction")] + public partial class RuleAction + { + /// + /// Initializes a new instance of the RuleAction class. + /// + public RuleAction() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs new file mode 100644 index 000000000000..4a1d4ec4aa1f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs @@ -0,0 +1,56 @@ +// +// 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 condition that results in the alert rule being activated. + /// + [Newtonsoft.Json.JsonObject("RuleCondition")] + public partial class RuleCondition + { + /// + /// Initializes a new instance of the RuleCondition class. + /// + public RuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleCondition class. + /// + /// the resource from which the rule collects + /// its data. For this type dataSource will always be of type + /// RuleMetricDataSource. + public RuleCondition(RuleDataSource dataSource = default(RuleDataSource)) + { + DataSource = dataSource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource from which the rule collects its data. + /// For this type dataSource will always be of type + /// RuleMetricDataSource. + /// + [JsonProperty(PropertyName = "dataSource")] + public RuleDataSource DataSource { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs new file mode 100644 index 000000000000..70b74b15f0fb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs @@ -0,0 +1,85 @@ +// +// 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 from which the rule collects its data. + /// + [Newtonsoft.Json.JsonObject("RuleDataSource")] + public partial class RuleDataSource + { + /// + /// Initializes a new instance of the RuleDataSource class. + /// + public RuleDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleDataSource class. + /// + /// the resource identifier of the resource + /// the rule monitors. **NOTE**: this property cannot be updated for an + /// existing rule. + /// the legacy resource identifier of + /// the resource the rule monitors. **NOTE**: this property cannot be + /// updated for an existing rule. + /// the location of the + /// resource. + /// the namespace of the metric. + public RuleDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string)) + { + ResourceUri = resourceUri; + LegacyResourceId = legacyResourceId; + ResourceLocation = resourceLocation; + MetricNamespace = metricNamespace; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource identifier of the resource the rule + /// monitors. **NOTE**: this property cannot be updated for an existing + /// rule. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets the legacy resource identifier of the resource the + /// rule monitors. **NOTE**: this property cannot be updated for an + /// existing rule. + /// + [JsonProperty(PropertyName = "legacyResourceId")] + public string LegacyResourceId { get; set; } + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "resourceLocation")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets the namespace of the metric. + /// + [JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs new file mode 100644 index 000000000000..5c8972fa6dec --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the action to send email when the rule condition is + /// evaluated. The discriminator is always RuleEmailAction in this case. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleEmailAction")] + public partial class RuleEmailAction : RuleAction + { + /// + /// Initializes a new instance of the RuleEmailAction class. + /// + public RuleEmailAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleEmailAction class. + /// + /// Whether the administrators + /// (service and co-administrators) of the service should be notified + /// when the alert is activated. + /// the list of administrator's custom email + /// addresses to notify of the activation of the alert. + public RuleEmailAction(bool? sendToServiceOwners = default(bool?), IList customEmails = default(IList)) + { + SendToServiceOwners = sendToServiceOwners; + CustomEmails = customEmails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether the administrators (service and + /// co-administrators) of the service should be notified when the alert + /// is activated. + /// + [JsonProperty(PropertyName = "sendToServiceOwners")] + public bool? SendToServiceOwners { get; set; } + + /// + /// Gets or sets the list of administrator's custom email addresses to + /// notify of the activation of the alert. + /// + [JsonProperty(PropertyName = "customEmails")] + public IList CustomEmails { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs new file mode 100644 index 000000000000..d2acb8d1268c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The claims for a rule management event data source. + /// + public partial class RuleManagementEventClaimsDataSource + { + /// + /// Initializes a new instance of the + /// RuleManagementEventClaimsDataSource class. + /// + public RuleManagementEventClaimsDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RuleManagementEventClaimsDataSource class. + /// + /// the email address. + public RuleManagementEventClaimsDataSource(string emailAddress = default(string)) + { + EmailAddress = emailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the email address. + /// + [JsonProperty(PropertyName = "emailAddress")] + public string EmailAddress { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs new file mode 100644 index 000000000000..8c50bf453300 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule management event data source. The discriminator fields is always + /// RuleManagementEventDataSource in this case. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource")] + public partial class RuleManagementEventDataSource : RuleDataSource + { + /// + /// Initializes a new instance of the RuleManagementEventDataSource + /// class. + /// + public RuleManagementEventDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleManagementEventDataSource + /// class. + /// + /// the resource identifier of the resource + /// the rule monitors. **NOTE**: this property cannot be updated for an + /// existing rule. + /// the legacy resource identifier of + /// the resource the rule monitors. **NOTE**: this property cannot be + /// updated for an existing rule. + /// the location of the + /// resource. + /// the namespace of the metric. + /// the event name. + /// the event source. + /// the level. + /// The name of the operation that should + /// be checked for. If no name is provided, any operation will + /// match. + /// the resource group name. + /// the resource provider + /// name. + /// The status of the operation that should be + /// checked for. If no status is provided, any status will + /// match. + /// the substatus. + /// the claims. + public RuleManagementEventDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string), string eventName = default(string), string eventSource = default(string), string level = default(string), string operationName = default(string), string resourceGroupName = default(string), string resourceProviderName = default(string), string status = default(string), string subStatus = default(string), RuleManagementEventClaimsDataSource claims = default(RuleManagementEventClaimsDataSource)) + : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) + { + EventName = eventName; + EventSource = eventSource; + Level = level; + OperationName = operationName; + ResourceGroupName = resourceGroupName; + ResourceProviderName = resourceProviderName; + Status = status; + SubStatus = subStatus; + Claims = claims; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the event name. + /// + [JsonProperty(PropertyName = "eventName")] + public string EventName { get; set; } + + /// + /// Gets or sets the event source. + /// + [JsonProperty(PropertyName = "eventSource")] + public string EventSource { get; set; } + + /// + /// Gets or sets the level. + /// + [JsonProperty(PropertyName = "level")] + public string Level { get; set; } + + /// + /// Gets or sets the name of the operation that should be checked for. + /// If no name is provided, any operation will match. + /// + [JsonProperty(PropertyName = "operationName")] + public string OperationName { get; set; } + + /// + /// Gets or sets the resource group name. + /// + [JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName { get; set; } + + /// + /// Gets or sets the resource provider name. + /// + [JsonProperty(PropertyName = "resourceProviderName")] + public string ResourceProviderName { get; set; } + + /// + /// Gets or sets the status of the operation that should be checked + /// for. If no status is provided, any status will match. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the substatus. + /// + [JsonProperty(PropertyName = "subStatus")] + public string SubStatus { get; set; } + + /// + /// Gets or sets the claims. + /// + [JsonProperty(PropertyName = "claims")] + public RuleManagementEventClaimsDataSource Claims { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs new file mode 100644 index 000000000000..7b650acc4bff --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs @@ -0,0 +1,65 @@ +// +// 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; + + /// + /// A rule metric data source. The discriminator value is always + /// RuleMetricDataSource in this case. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource")] + public partial class RuleMetricDataSource : RuleDataSource + { + /// + /// Initializes a new instance of the RuleMetricDataSource class. + /// + public RuleMetricDataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleMetricDataSource class. + /// + /// the resource identifier of the resource + /// the rule monitors. **NOTE**: this property cannot be updated for an + /// existing rule. + /// the legacy resource identifier of + /// the resource the rule monitors. **NOTE**: this property cannot be + /// updated for an existing rule. + /// the location of the + /// resource. + /// the namespace of the metric. + /// the name of the metric that defines what + /// the rule monitors. + public RuleMetricDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string), string metricName = default(string)) + : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) + { + MetricName = metricName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metric that defines what the rule + /// monitors. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs new file mode 100644 index 000000000000..b70d12e5444b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the action to post to service when the rule condition is + /// evaluated. The discriminator is always RuleWebhookAction in this case. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleWebhookAction")] + public partial class RuleWebhookAction : RuleAction + { + /// + /// Initializes a new instance of the RuleWebhookAction class. + /// + public RuleWebhookAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RuleWebhookAction class. + /// + /// the service uri to Post the notification + /// when the alert activates or resolves. + /// the dictionary of custom properties to + /// include with the post operation. These data are appended to the + /// webhook payload. + public RuleWebhookAction(string serviceUri = default(string), IDictionary properties = default(IDictionary)) + { + ServiceUri = serviceUri; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the service uri to Post the notification when the + /// alert activates or resolves. + /// + [JsonProperty(PropertyName = "serviceUri")] + public string ServiceUri { get; set; } + + /// + /// Gets or sets the dictionary of custom properties to include with + /// the post operation. These data are appended to the webhook payload. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs new file mode 100644 index 000000000000..9f23316376c8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs @@ -0,0 +1,101 @@ +// +// 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 parameters for the scaling action. + /// + public partial class ScaleAction + { + /// + /// Initializes a new instance of the ScaleAction class. + /// + public ScaleAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleAction class. + /// + /// the scale direction. Whether the scaling + /// action increases or decreases the number of instances. Possible + /// values include: 'None', 'Increase', 'Decrease' + /// the type of action that should occur when the + /// scale rule fires. Possible values include: 'ChangeCount', + /// 'PercentChangeCount', 'ExactCount', + /// 'ServiceAllowedNextValue' + /// the amount of time to wait since the last + /// scaling action before this action occurs. It must be between 1 week + /// and 1 minute in ISO 8601 format. + /// the number of instances that are involved in + /// the scaling action. This value must be 1 or greater. The default + /// value is 1. + public ScaleAction(ScaleDirection direction, ScaleType type, System.TimeSpan cooldown, string value = default(string)) + { + Direction = direction; + Type = type; + Value = value; + Cooldown = cooldown; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the scale direction. Whether the scaling action + /// increases or decreases the number of instances. Possible values + /// include: 'None', 'Increase', 'Decrease' + /// + [JsonProperty(PropertyName = "direction")] + public ScaleDirection Direction { get; set; } + + /// + /// Gets or sets the type of action that should occur when the scale + /// rule fires. Possible values include: 'ChangeCount', + /// 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' + /// + [JsonProperty(PropertyName = "type")] + public ScaleType Type { get; set; } + + /// + /// Gets or sets the number of instances that are involved in the + /// scaling action. This value must be 1 or greater. The default value + /// is 1. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the amount of time to wait since the last scaling + /// action before this action occurs. It must be between 1 week and 1 + /// minute in ISO 8601 format. + /// + [JsonProperty(PropertyName = "cooldown")] + public System.TimeSpan Cooldown { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs new file mode 100644 index 000000000000..755f92253b1f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs @@ -0,0 +1,99 @@ +// +// 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; + + /// + /// The number of instances that can be used during this profile. + /// + public partial class ScaleCapacity + { + /// + /// Initializes a new instance of the ScaleCapacity class. + /// + public ScaleCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleCapacity class. + /// + /// the minimum number of instances for the + /// resource. + /// the maximum number of instances for the + /// resource. The actual maximum number of instances is limited by the + /// cores that are available in the subscription. + /// the number of instances that will be + /// set if metrics are not available for evaluation. The default is + /// only used if the current instance count is lower than the + /// default. + public ScaleCapacity(string minimum, string maximum, string defaultProperty) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum number of instances for the resource. + /// + [JsonProperty(PropertyName = "minimum")] + public string Minimum { get; set; } + + /// + /// Gets or sets the maximum number of instances for the resource. The + /// actual maximum number of instances is limited by the cores that are + /// available in the subscription. + /// + [JsonProperty(PropertyName = "maximum")] + public string Maximum { get; set; } + + /// + /// Gets or sets the number of instances that will be set if metrics + /// are not available for evaluation. The default is only used if the + /// current instance count is lower than the default. + /// + [JsonProperty(PropertyName = "default")] + public string DefaultProperty { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Minimum == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Minimum"); + } + if (Maximum == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Maximum"); + } + if (DefaultProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DefaultProperty"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs new file mode 100644 index 000000000000..858c37739fdb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ScaleDirection. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ScaleDirection + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Increase")] + Increase, + [EnumMember(Value = "Decrease")] + Decrease + } + internal static class ScaleDirectionEnumExtension + { + internal static string ToSerializedValue(this ScaleDirection? value) + { + return value == null ? null : ((ScaleDirection)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ScaleDirection value) + { + switch( value ) + { + case ScaleDirection.None: + return "None"; + case ScaleDirection.Increase: + return "Increase"; + case ScaleDirection.Decrease: + return "Decrease"; + } + return null; + } + + internal static ScaleDirection? ParseScaleDirection(this string value) + { + switch( value ) + { + case "None": + return ScaleDirection.None; + case "Increase": + return ScaleDirection.Increase; + case "Decrease": + return ScaleDirection.Decrease; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs new file mode 100644 index 000000000000..2f061a1523d5 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs @@ -0,0 +1,87 @@ +// +// 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; + + /// + /// A rule that provide the triggers and parameters for the scaling action. + /// + public partial class ScaleRule + { + /// + /// Initializes a new instance of the ScaleRule class. + /// + public ScaleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleRule class. + /// + /// the trigger that results in a scaling + /// action. + /// the parameters for the scaling + /// action. + public ScaleRule(MetricTrigger metricTrigger, ScaleAction scaleAction) + { + MetricTrigger = metricTrigger; + ScaleAction = scaleAction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the trigger that results in a scaling action. + /// + [JsonProperty(PropertyName = "metricTrigger")] + public MetricTrigger MetricTrigger { get; set; } + + /// + /// Gets or sets the parameters for the scaling action. + /// + [JsonProperty(PropertyName = "scaleAction")] + public ScaleAction ScaleAction { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetricTrigger == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricTrigger"); + } + if (ScaleAction == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScaleAction"); + } + if (MetricTrigger != null) + { + MetricTrigger.Validate(); + } + if (ScaleAction != null) + { + ScaleAction.Validate(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs new file mode 100644 index 000000000000..9cb036d6fed2 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies an auto scale rule metric dimension. + /// + public partial class ScaleRuleMetricDimension + { + /// + /// Initializes a new instance of the ScaleRuleMetricDimension class. + /// + public ScaleRuleMetricDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleRuleMetricDimension class. + /// + /// Name of the dimension. + /// the dimension operator. Only + /// 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any + /// of the values. 'NotEquals' being not equal to all of the values. + /// Possible values include: 'Equals', 'NotEquals' + /// list of dimension values. For example: + /// ["App1","App2"]. + public ScaleRuleMetricDimension(string dimensionName, string operatorProperty, IList values) + { + DimensionName = dimensionName; + OperatorProperty = operatorProperty; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the dimension. + /// + [JsonProperty(PropertyName = "DimensionName")] + public string DimensionName { get; set; } + + /// + /// Gets or sets the dimension operator. Only 'Equals' and 'NotEquals' + /// are supported. 'Equals' being equal to any of the values. + /// 'NotEquals' being not equal to all of the values. Possible values + /// include: 'Equals', 'NotEquals' + /// + [JsonProperty(PropertyName = "Operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets list of dimension values. For example: + /// ["App1","App2"]. + /// + [JsonProperty(PropertyName = "Values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DimensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DimensionName"); + } + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs new file mode 100644 index 000000000000..3ff0455f3c4e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + + /// + /// Defines values for ScaleRuleMetricDimensionOperationType. + /// + public static class ScaleRuleMetricDimensionOperationType + { + public const string Equals = "Equals"; + public const string NotEquals = "NotEquals"; + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs new file mode 100644 index 000000000000..de3dbf23de2f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs @@ -0,0 +1,72 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ScaleType + { + [EnumMember(Value = "ChangeCount")] + ChangeCount, + [EnumMember(Value = "PercentChangeCount")] + PercentChangeCount, + [EnumMember(Value = "ExactCount")] + ExactCount, + [EnumMember(Value = "ServiceAllowedNextValue")] + ServiceAllowedNextValue + } + internal static class ScaleTypeEnumExtension + { + internal static string ToSerializedValue(this ScaleType? value) + { + return value == null ? null : ((ScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ScaleType value) + { + switch( value ) + { + case ScaleType.ChangeCount: + return "ChangeCount"; + case ScaleType.PercentChangeCount: + return "PercentChangeCount"; + case ScaleType.ExactCount: + return "ExactCount"; + case ScaleType.ServiceAllowedNextValue: + return "ServiceAllowedNextValue"; + } + return null; + } + + internal static ScaleType? ParseScaleType(this string value) + { + switch( value ) + { + case "ChangeCount": + return ScaleType.ChangeCount; + case "PercentChangeCount": + return ScaleType.PercentChangeCount; + case "ExactCount": + return ScaleType.ExactCount; + case "ServiceAllowedNextValue": + return ScaleType.ServiceAllowedNextValue; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs new file mode 100644 index 000000000000..bbfe8c1a2fad --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.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/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs new file mode 100644 index 000000000000..b039c91346dd --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs @@ -0,0 +1,72 @@ +// +// 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 authorization used by the user who has performed the operation that + /// led to this event. This captures the RBAC properties of the event. + /// These usually include the 'action', 'role' and the 'scope' + /// + public partial class SenderAuthorization + { + /// + /// Initializes a new instance of the SenderAuthorization class. + /// + public SenderAuthorization() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SenderAuthorization class. + /// + /// the permissible actions. For instance: + /// microsoft.support/supporttickets/write + /// the role of the user. For instance: Subscription + /// Admin + /// the scope. + public SenderAuthorization(string action = default(string), string role = default(string), string scope = default(string)) + { + Action = action; + Role = role; + Scope = scope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the permissible actions. For instance: + /// microsoft.support/supporttickets/write + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// Gets or sets the role of the user. For instance: Subscription Admin + /// + [JsonProperty(PropertyName = "role")] + public string Role { get; set; } + + /// + /// Gets or sets the scope. + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs new file mode 100644 index 000000000000..8959f4d061eb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The baseline values for a single sensitivity value. + /// + public partial class SingleBaseline + { + /// + /// Initializes a new instance of the SingleBaseline class. + /// + public SingleBaseline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SingleBaseline class. + /// + /// the sensitivity of the baseline. Possible + /// values include: 'Low', 'Medium', 'High' + /// The low thresholds of the + /// baseline. + /// The high thresholds of the + /// baseline. + public SingleBaseline(string sensitivity, IList lowThresholds, IList highThresholds) + { + Sensitivity = sensitivity; + LowThresholds = lowThresholds; + HighThresholds = highThresholds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sensitivity of the baseline. Possible values + /// include: 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "sensitivity")] + public string Sensitivity { get; set; } + + /// + /// Gets or sets the low thresholds of the baseline. + /// + [JsonProperty(PropertyName = "lowThresholds")] + public IList LowThresholds { get; set; } + + /// + /// Gets or sets the high thresholds of the baseline. + /// + [JsonProperty(PropertyName = "highThresholds")] + public IList HighThresholds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sensitivity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sensitivity"); + } + if (LowThresholds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LowThresholds"); + } + if (HighThresholds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HighThresholds"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs new file mode 100644 index 000000000000..d7d36f282e52 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs @@ -0,0 +1,160 @@ +// +// 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; + + /// + /// The baseline results of a single metric. + /// + [Rest.Serialization.JsonTransformation] + public partial class SingleMetricBaseline + { + /// + /// Initializes a new instance of the SingleMetricBaseline class. + /// + public SingleMetricBaseline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SingleMetricBaseline class. + /// + /// The metric baseline Id. + /// The resource type of the metric baseline + /// resource. + /// The name of the metric for which the baselines + /// were retrieved. + /// The timespan for which the data was + /// retrieved. Its value consists of two datetimes concatenated, + /// separated by '/'. This may be adjusted in the future and returned + /// back from what was originally requested. + /// The interval (window size) for which the + /// metric data was returned in. This may be adjusted in the future + /// and returned back from what was originally requested. This is not + /// present if a metadata request was made. + /// The baseline for each time series that was + /// queried. + /// The namespace of the metrics been + /// queried. + public SingleMetricBaseline(string id, string type, string name, string timespan, System.TimeSpan interval, IList baselines, string namespaceProperty = default(string)) + { + Id = id; + Type = type; + Name = name; + Timespan = timespan; + Interval = interval; + NamespaceProperty = namespaceProperty; + Baselines = baselines; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric baseline Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the resource type of the metric baseline resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the metric for which the baselines were + /// retrieved. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the timespan for which the data was retrieved. Its + /// value consists of two datetimes concatenated, separated by '/'. + /// This may be adjusted in the future and returned back from what was + /// originally requested. + /// + [JsonProperty(PropertyName = "properties.timespan")] + public string Timespan { get; set; } + + /// + /// Gets or sets the interval (window size) for which the metric data + /// was returned in. This may be adjusted in the future and returned + /// back from what was originally requested. This is not present if a + /// metadata request was made. + /// + [JsonProperty(PropertyName = "properties.interval")] + public System.TimeSpan Interval { get; set; } + + /// + /// Gets or sets the namespace of the metrics been queried. + /// + [JsonProperty(PropertyName = "properties.namespace")] + public string NamespaceProperty { get; set; } + + /// + /// Gets or sets the baseline for each time series that was queried. + /// + [JsonProperty(PropertyName = "properties.baselines")] + public IList Baselines { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Timespan == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); + } + if (Baselines == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Baselines"); + } + if (Baselines != null) + { + foreach (var element in Baselines) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs new file mode 100644 index 000000000000..3dc9207c30c3 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs @@ -0,0 +1,54 @@ +// +// 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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs new file mode 100644 index 000000000000..e376a972718d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs @@ -0,0 +1,106 @@ +// +// 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; + + /// + /// A rule condition based on a metric crossing a threshold. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition")] + public partial class ThresholdRuleCondition : RuleCondition + { + /// + /// Initializes a new instance of the ThresholdRuleCondition class. + /// + public ThresholdRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThresholdRuleCondition class. + /// + /// the operator used to compare the + /// data and the threshold. Possible values include: 'GreaterThan', + /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// the threshold value that activates the + /// alert. + /// the resource from which the rule collects + /// its data. For this type dataSource will always be of type + /// RuleMetricDataSource. + /// the period of time (in ISO 8601 duration + /// format) that is used to monitor alert activity based on the + /// threshold. If specified then it must be between 5 minutes and 1 + /// day. + /// the time aggregation operator. How + /// the data that are collected should be combined over time. The + /// default value is the PrimaryAggregationType of the Metric. Possible + /// values include: 'Average', 'Minimum', 'Maximum', 'Total', + /// 'Last' + public ThresholdRuleCondition(ConditionOperator operatorProperty, double threshold, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?), TimeAggregationOperator? timeAggregation = default(TimeAggregationOperator?)) + : base(dataSource) + { + OperatorProperty = operatorProperty; + Threshold = threshold; + WindowSize = windowSize; + TimeAggregation = timeAggregation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operator used to compare the data and the + /// threshold. Possible values include: 'GreaterThan', + /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// + [JsonProperty(PropertyName = "operator")] + public ConditionOperator OperatorProperty { get; set; } + + /// + /// Gets or sets the threshold value that activates the alert. + /// + [JsonProperty(PropertyName = "threshold")] + public double Threshold { 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. If + /// specified then it must be between 5 minutes and 1 day. + /// + [JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize { get; set; } + + /// + /// Gets or sets the time aggregation operator. How the data that are + /// collected should be combined over time. The default value is the + /// PrimaryAggregationType of the Metric. Possible values include: + /// 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + /// + [JsonProperty(PropertyName = "timeAggregation")] + public TimeAggregationOperator? TimeAggregation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs new file mode 100644 index 000000000000..863bbac3ce8a --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs @@ -0,0 +1,78 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for TimeAggregationOperator. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TimeAggregationOperator + { + [EnumMember(Value = "Average")] + Average, + [EnumMember(Value = "Minimum")] + Minimum, + [EnumMember(Value = "Maximum")] + Maximum, + [EnumMember(Value = "Total")] + Total, + [EnumMember(Value = "Last")] + Last + } + internal static class TimeAggregationOperatorEnumExtension + { + internal static string ToSerializedValue(this TimeAggregationOperator? value) + { + return value == null ? null : ((TimeAggregationOperator)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this TimeAggregationOperator value) + { + switch( value ) + { + case TimeAggregationOperator.Average: + return "Average"; + case TimeAggregationOperator.Minimum: + return "Minimum"; + case TimeAggregationOperator.Maximum: + return "Maximum"; + case TimeAggregationOperator.Total: + return "Total"; + case TimeAggregationOperator.Last: + return "Last"; + } + return null; + } + + internal static TimeAggregationOperator? ParseTimeAggregationOperator(this string value) + { + switch( value ) + { + case "Average": + return TimeAggregationOperator.Average; + case "Minimum": + return TimeAggregationOperator.Minimum; + case "Maximum": + return TimeAggregationOperator.Maximum; + case "Total": + return TimeAggregationOperator.Total; + case "Last": + return TimeAggregationOperator.Last; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs new file mode 100644 index 000000000000..771c356ab52e --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for TimeAggregationType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TimeAggregationType + { + [EnumMember(Value = "Average")] + Average, + [EnumMember(Value = "Minimum")] + Minimum, + [EnumMember(Value = "Maximum")] + Maximum, + [EnumMember(Value = "Total")] + Total, + [EnumMember(Value = "Count")] + Count, + [EnumMember(Value = "Last")] + Last + } + internal static class TimeAggregationTypeEnumExtension + { + internal static string ToSerializedValue(this TimeAggregationType? value) + { + return value == null ? null : ((TimeAggregationType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this TimeAggregationType value) + { + switch( value ) + { + case TimeAggregationType.Average: + return "Average"; + case TimeAggregationType.Minimum: + return "Minimum"; + case TimeAggregationType.Maximum: + return "Maximum"; + case TimeAggregationType.Total: + return "Total"; + case TimeAggregationType.Count: + return "Count"; + case TimeAggregationType.Last: + return "Last"; + } + return null; + } + + internal static TimeAggregationType? ParseTimeAggregationType(this string value) + { + switch( value ) + { + case "Average": + return TimeAggregationType.Average; + case "Minimum": + return TimeAggregationType.Minimum; + case "Maximum": + return TimeAggregationType.Maximum; + case "Total": + return TimeAggregationType.Total; + case "Count": + return TimeAggregationType.Count; + case "Last": + return TimeAggregationType.Last; + } + return null; + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs new file mode 100644 index 000000000000..931c37ed3405 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The baseline values for a single time series. + /// + public partial class TimeSeriesBaseline + { + /// + /// Initializes a new instance of the TimeSeriesBaseline class. + /// + public TimeSeriesBaseline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeSeriesBaseline class. + /// + /// The aggregation type of the + /// metric. + /// The list of timestamps of the + /// baselines. + /// The baseline values for each + /// sensitivity. + /// The dimensions of this time + /// series. + /// 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; + MetadataValues = metadataValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the aggregation type of the metric. + /// + [JsonProperty(PropertyName = "aggregation")] + public string Aggregation { get; set; } + + /// + /// Gets or sets the dimensions of this time series. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets the list of timestamps of the baselines. + /// + [JsonProperty(PropertyName = "timestamps")] + public IList Timestamps { get; set; } + + /// + /// Gets or sets the baseline values for each sensitivity. + /// + [JsonProperty(PropertyName = "data")] + public IList Data { get; set; } + + /// + /// Gets or sets the baseline metadata values. + /// + [JsonProperty(PropertyName = "metadataValues")] + public IList MetadataValues { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Aggregation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Aggregation"); + } + if (Timestamps == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timestamps"); + } + if (Data == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Data"); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Data != null) + { + foreach (var element1 in Data) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (MetadataValues != null) + { + foreach (var element2 in MetadataValues) + { + if (element2 != null) + { + element2.Validate(); + } + } + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs new file mode 100644 index 000000000000..6d30fba03f4f --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A time series result type. The discriminator value is always TimeSeries + /// in this case. + /// + public partial class TimeSeriesElement + { + /// + /// Initializes a new instance of the TimeSeriesElement class. + /// + public TimeSeriesElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeSeriesElement class. + /// + /// the metadata values returned if + /// $filter was specified in the call. + /// An array of data points representing the metric + /// values. This is only returned if a result type of data is + /// specified. + public TimeSeriesElement(IList metadatavalues = default(IList), IList data = default(IList)) + { + Metadatavalues = metadatavalues; + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata values returned if $filter was specified + /// in the call. + /// + [JsonProperty(PropertyName = "metadatavalues")] + public IList Metadatavalues { get; set; } + + /// + /// Gets or sets an array of data points representing the metric + /// values. This is only returned if a result type of data is + /// specified. + /// + [JsonProperty(PropertyName = "data")] + public IList Data { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs new file mode 100644 index 000000000000..6eba68156e24 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs @@ -0,0 +1,162 @@ +// +// 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; + + /// + /// A specific date-time for the profile. + /// + public partial class TimeWindow + { + /// + /// Initializes a new instance of the TimeWindow class. + /// + public TimeWindow() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeWindow class. + /// + /// the start time for the profile in ISO 8601 + /// format. + /// the end time for the profile in ISO 8601 + /// format. + /// the timezone of the start and end times for + /// the profile. Some examples of valid time zones are: Dateline + /// Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard + /// Time, Pacific Standard Time (Mexico), Pacific Standard Time, US + /// Mountain Standard Time, Mountain Standard Time (Mexico), Mountain + /// Standard Time, Central America Standard Time, Central Standard + /// Time, Central Standard Time (Mexico), Canada Central Standard Time, + /// SA Pacific Standard Time, Eastern Standard Time, US Eastern + /// Standard Time, Venezuela Standard Time, Paraguay Standard Time, + /// Atlantic Standard Time, Central Brazilian Standard Time, SA Western + /// Standard Time, Pacific SA Standard Time, Newfoundland Standard + /// Time, E. South America Standard Time, Argentina Standard Time, SA + /// Eastern Standard Time, Greenland Standard Time, Montevideo Standard + /// Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, + /// Azores Standard Time, Cape Verde Standard Time, Morocco Standard + /// Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe + /// Standard Time, Central Europe Standard Time, Romance Standard Time, + /// Central European Standard Time, W. Central Africa Standard Time, + /// Namibia Standard Time, Jordan Standard Time, GTB Standard Time, + /// Middle East Standard Time, Egypt Standard Time, Syria Standard + /// Time, E. Europe Standard Time, South Africa Standard Time, FLE + /// Standard Time, Turkey Standard Time, Israel Standard Time, + /// Kaliningrad Standard Time, Libya Standard Time, Arabic Standard + /// Time, Arab Standard Time, Belarus Standard Time, Russian Standard + /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard + /// Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius + /// Standard Time, Georgian Standard Time, Caucasus Standard Time, + /// Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg + /// Standard Time, Pakistan Standard Time, India Standard Time, Sri + /// Lanka Standard Time, Nepal Standard Time, Central Asia Standard + /// Time, Bangladesh Standard Time, N. Central Asia Standard Time, + /// Myanmar Standard Time, SE Asia Standard Time, North Asia Standard + /// Time, China Standard Time, North Asia East Standard Time, Singapore + /// Standard Time, W. Australia Standard Time, Taipei Standard Time, + /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard + /// Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS + /// Central Standard Time, E. Australia Standard Time, AUS Eastern + /// Standard Time, West Pacific Standard Time, Tasmania Standard Time, + /// Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone + /// 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + /// Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, + /// Tonga Standard Time, Samoa Standard Time, Line Islands Standard + /// Time + public TimeWindow(System.DateTime start, System.DateTime end, string timeZone = default(string)) + { + TimeZone = timeZone; + Start = start; + End = end; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timezone of the start and end times for the + /// profile. Some examples of valid time zones are: Dateline Standard + /// Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, + /// Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain + /// Standard Time, Mountain Standard Time (Mexico), Mountain Standard + /// Time, Central America Standard Time, Central Standard Time, Central + /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific + /// Standard Time, Eastern Standard Time, US Eastern Standard Time, + /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard + /// Time, Central Brazilian Standard Time, SA Western Standard Time, + /// Pacific SA Standard Time, Newfoundland Standard Time, E. South + /// America Standard Time, Argentina Standard Time, SA Eastern Standard + /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia + /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard + /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT + /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, + /// Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia + /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East + /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe + /// Standard Time, South Africa Standard Time, FLE Standard Time, + /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard + /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard + /// Time, Belarus Standard Time, Russian Standard Time, E. Africa + /// Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard + /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan + /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, + /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard + /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh + /// Standard Time, N. Central Asia Standard Time, Myanmar Standard + /// Time, SE Asia Standard Time, North Asia Standard Time, China + /// Standard Time, North Asia East Standard Time, Singapore Standard + /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar + /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk + /// Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West + /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard + /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central + /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + /// Standard Time, Samoa Standard Time, Line Islands Standard Time + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets the start time for the profile in ISO 8601 format. + /// + [JsonProperty(PropertyName = "start")] + public System.DateTime Start { get; set; } + + /// + /// Gets or sets the end time for the profile in ISO 8601 format. + /// + [JsonProperty(PropertyName = "end")] + public System.DateTime End { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs new file mode 100644 index 000000000000..fb61f5519717 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Webhook notification of an autoscale event. + /// + public partial class WebhookNotification + { + /// + /// Initializes a new instance of the WebhookNotification class. + /// + public WebhookNotification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebhookNotification class. + /// + /// the service address to receive the + /// notification. + /// a property bag of settings. This value can + /// be empty. + public WebhookNotification(string serviceUri = default(string), IDictionary properties = default(IDictionary)) + { + ServiceUri = serviceUri; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the service address to receive the notification. + /// + [JsonProperty(PropertyName = "serviceUri")] + public string ServiceUri { get; set; } + + /// + /// Gets or sets a property bag of settings. This value can be empty. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs new file mode 100644 index 000000000000..9ade80267628 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the metric alert rule criteria for a web test resource. + /// + [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria")] + public partial class WebtestLocationAvailabilityCriteria : MetricAlertCriteria + { + /// + /// Initializes a new instance of the + /// WebtestLocationAvailabilityCriteria class. + /// + public WebtestLocationAvailabilityCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// WebtestLocationAvailabilityCriteria class. + /// + /// The Application Insights web test + /// Id. + /// The Application Insights resource + /// Id. + /// The number of failed + /// locations. + /// Unmatched properties from the + /// message are deserialized this collection + public WebtestLocationAvailabilityCriteria(string webTestId, string componentId, double failedLocationCount, IDictionary additionalProperties = default(IDictionary)) + : base(additionalProperties) + { + WebTestId = webTestId; + ComponentId = componentId; + FailedLocationCount = failedLocationCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Application Insights web test Id. + /// + [JsonProperty(PropertyName = "webTestId")] + public string WebTestId { get; set; } + + /// + /// Gets or sets the Application Insights resource Id. + /// + [JsonProperty(PropertyName = "componentId")] + public string ComponentId { get; set; } + + /// + /// Gets or sets the number of failed locations. + /// + [JsonProperty(PropertyName = "failedLocationCount")] + public double FailedLocationCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WebTestId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WebTestId"); + } + if (ComponentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ComponentId"); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs new file mode 100644 index 000000000000..05a642c1468c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs @@ -0,0 +1,460 @@ +// +// 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 Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Monitor Management Client + /// + public partial class MonitorManagementClient : ServiceClient, IMonitorManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The ID of the target subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IAutoscaleSettingsOperations. + /// + public virtual IAutoscaleSettingsOperations AutoscaleSettings { get; private set; } + + /// + /// Gets the IAlertRulesOperations. + /// + public virtual IAlertRulesOperations AlertRules { get; private set; } + + /// + /// Gets the ILogProfilesOperations. + /// + public virtual ILogProfilesOperations LogProfiles { get; private set; } + + /// + /// Gets the IDiagnosticSettingsOperations. + /// + public virtual IDiagnosticSettingsOperations DiagnosticSettings { get; private set; } + + /// + /// Gets the IActivityLogsOperations. + /// + public virtual IActivityLogsOperations ActivityLogs { get; private set; } + + /// + /// Gets the IEventCategoriesOperations. + /// + public virtual IEventCategoriesOperations EventCategories { get; private set; } + + /// + /// Gets the IMetricDefinitionsOperations. + /// + public virtual IMetricDefinitionsOperations MetricDefinitions { get; private set; } + + /// + /// Gets the IMetricsOperations. + /// + public virtual IMetricsOperations Metrics { get; private set; } + + /// + /// Gets the IBaselinesOperations. + /// + public virtual IBaselinesOperations Baselines { get; private set; } + + /// + /// Gets the IMetricAlertsOperations. + /// + public virtual IMetricAlertsOperations MetricAlerts { get; private set; } + + /// + /// Gets the IMetricAlertsStatusOperations. + /// + public virtual IMetricAlertsStatusOperations MetricAlertsStatus { get; private set; } + + /// + /// Gets the IMetricNamespacesOperations. + /// + public virtual IMetricNamespacesOperations MetricNamespaces { 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; } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling MonitorManagementClient.Dispose(). False: will not dispose provided httpClient + protected MonitorManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected MonitorManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected MonitorManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected MonitorManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected MonitorManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public MonitorManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling MonitorManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public MonitorManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public MonitorManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the MonitorManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + AutoscaleSettings = new AutoscaleSettingsOperations(this); + AlertRules = new AlertRulesOperations(this); + LogProfiles = new LogProfilesOperations(this); + DiagnosticSettings = new DiagnosticSettingsOperations(this); + ActivityLogs = new ActivityLogsOperations(this); + EventCategories = new EventCategoriesOperations(this); + MetricDefinitions = new MetricDefinitionsOperations(this); + Metrics = new MetricsOperations(this); + Baselines = new BaselinesOperations(this); + MetricAlerts = new MetricAlertsOperations(this); + MetricAlertsStatus = new MetricAlertsStatusOperations(this); + MetricNamespaces = new MetricNamespacesOperations(this); + PrivateLinkScopes = new PrivateLinkScopesOperations(this); + PrivateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("criterionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("criterionType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..f23a07af866b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1150 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..f154ba186236 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,331 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..19abc53f2f06 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,663 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..60ce383a270c --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,151 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs new file mode 100644 index 000000000000..4ff6cb960b4d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs @@ -0,0 +1,267 @@ +// +// 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. 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 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 (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 (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-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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs new file mode 100644 index 000000000000..67cfc122b2a1 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// 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. The name is case insensitive. + /// + 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 name is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs new file mode 100644 index 000000000000..c7f8454f078d --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs @@ -0,0 +1,1167 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..9d1eb0b2ef67 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs new file mode 100644 index 000000000000..198c94b8b6c3 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs @@ -0,0 +1,1690 @@ +// +// 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"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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. 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 (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 (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-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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 (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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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 (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 is case insensitive. + /// + /// + /// 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 (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 (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 (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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs new file mode 100644 index 000000000000..775786a5a3c9 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs @@ -0,0 +1,371 @@ +// +// 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. The name is case insensitive. + /// + 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 name is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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 is case insensitive. + /// + /// + /// 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/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs new file mode 100644 index 000000000000..14838a1b84cb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs @@ -0,0 +1,43 @@ + +// +// 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_MonitorManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Insights", "ActivityLogs", "2015-04-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", "EventCategories", "2015-04-01"), + new Tuple("Insights", "LogProfiles", "2016-03-01"), + new Tuple("Insights", "MetricAlerts", "2018-03-01"), + new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), + new Tuple("Insights", "MetricDefinitions", "2018-01-01"), + new Tuple("Insights", "Metrics", "2018-01-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", "MetricNamespaces", "2017-12-01-preview"), + new Tuple("insights", "PrivateLinkScopeOperationStatus", "2019-10-17-preview"), + new Tuple("insights", "PrivateLinkScopes", "2019-10-17-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/Monitor/Monitor.Management.Sdk/Monitor.Management.Sdk.csproj b/src/Monitor/Monitor.Management.Sdk/Monitor.Management.Sdk.csproj new file mode 100644 index 000000000000..b7a4905a0e66 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Monitor.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + Monitor + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Monitor.Management.Sdk + Microsoft.Azure.Management.Monitor + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Properties/AssemblyInfo.cs b/src/Monitor/Monitor.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..e5c68a38cdd1 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Monitor Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("0.28.0.0")] +[assembly: AssemblyFileVersion("0.28.0.0")] \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/README.md b/src/Monitor/Monitor.Management.Sdk/README.md new file mode 100644 index 000000000000..8b7cca548afe --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/README.md @@ -0,0 +1,123 @@ +# Overall +This directory contains management plane service clients of Az.Monitor module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@microsoft.azure/autorest.csharp@2.3.90 +autorest.cmd README.md --version=v2 +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +csharp: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +title: MonitorManagementClient +description: Monitor Management Client +payload-flattening-threshold: 1 +``` + +### +``` yaml +commit: 92cf370fd73318f3cf92c36403274ba695873857 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/autoscale_API.json + # - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json + # - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRulesIncidents_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRules_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/logProfiles_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/diagnosticsSettings_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/activityLogs_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/eventCategories_API.json + # - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/tenantActivityLogs_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metricDefinitions_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metrics_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/metricBaselines_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/metricAlert_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json + # - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/vmInsightsOnboarding_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/privateLinkScopes_API.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Monitor + +directive: + - suppress: Example Validations + reason: There are open issues (bugs) in the validator affecting some of the examples and since there is no way to selectively disable the validation for a particular example or paths, all of the example validation is being turned off. + - suppress: R4009 + from: privateLinkScopes_API.json + reason: 'Contract is defined in the Network RP private endpoint spec, can be updated by internal calls from Network RP. ' + - suppress: R3018 + from: privateLinkScopes_API.json + where: $.definitions.PrivateEndpointConnectionProperties.properties.queryOnlyPrivateLinkResources + reason: 'This property indicates whether data coming through this private endpoint should restrict itself only to resources in the scope - it has only ''''true'''' or ''''false'''' options, so it fits boolean type.' + - suppress: R3018 + from: privateLinkScopes_API.json + where: $.definitions.PrivateEndpointConnectionProperties.properties.ingestOnlyToPrivateLinkResources + reason: 'This property indicates whether data coming through this private endpoint should restrict itself only to resources in the scope - it has only ''''true'''' or ''''false'''' options, so it fits boolean type.' + - suppress: OperationsAPIImplementation + from: privateLinkScopes_API.json + where: $.paths + reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' + - suppress: R3016 + reason: The feature (polymorphic types) is in the process of deprecation and fixing this will require changes in the backend. + + - suppress: MissingTypeObject + from: metrics_API.json + where: $.definitions.LocalizableString + reason: 'LocalizableString exists in other swaggers my team can not modify' + - suppress: MissingTypeObject + from: metricDefinitions_API.json + where: $.definitions.LocalizableString + reason: 'LocalizableString exists in other swaggers my team can not modify' + - suppress: OperationsAPIImplementation + where: $.paths + from: activityLogAlerts_API.json + reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' + - suppress: R3016 + where: $.definitions.Action.properties["odata.type"] + reason: 'This is an old field in a stable api version which is not camel cased' + - suppress: EnumInsteadOfBoolean + where: $.definitions.AlertRuleProperties.properties.enabled + from: activityLogAlerts_API.json + reason: 'This property indicates whether the alert rule is enabled or not - it has only ''''true'''' or ''''false'''' options, so it fits boolean type.' + - suppress: EnumInsteadOfBoolean + where: $.definitions.AlertRulePatchProperties.properties.enabled + from: activityLogAlerts_API.json + reason: 'This property indicates whether the alert rule is enabled or not - it has only ''''true'''' or ''''false'''' options, so it fits boolean type.' + - suppress: DefaultErrorResponseSchema + from: activityLogAlerts_API.json + reason: 'Updating the error response to the new format would be a breaking change.' + - suppress: DefaultErrorResponseSchema + from: metricNamespaces_API.json + reason: 'Updating the error response to the new format would be a breaking change.' + - suppress: DefaultErrorResponseSchema + from: metrics_API.json + reason: 'Updating the error response to the new format would be a breaking change.' + - suppress: DefaultErrorResponseSchema + from: metricDefinitions_API.json + reason: 'Updating the error response to the new format would be a breaking change.' + - suppress: OperationsAPIImplementation + from: operations_API.json + where: $.paths + reason: 'The operations API is implemented however the tool is still firing due to the casing being different' + - suppress: OperationsAPIImplementation + from: serviceDiagnosticsSettings_API.json + where: $.paths + reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' + - suppress: OperationsAPIImplementation + from: subscriptionDiagnosticsSettings_API.json + where: $.paths + reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' + - suppress: OperationsAPIImplementation + from: autoscale_API.json + where: $.paths + reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' +``` \ No newline at end of file diff --git a/src/Monitor/Monitor.Test/Monitor.Test.csproj b/src/Monitor/Monitor.Test/Monitor.Test.csproj index 27edf5cb975d..82528048ec9f 100644 --- a/src/Monitor/Monitor.Test/Monitor.Test.csproj +++ b/src/Monitor/Monitor.Test/Monitor.Test.csproj @@ -11,12 +11,12 @@ - + diff --git a/src/Monitor/Monitor.sln b/src/Monitor/Monitor.sln index 79eef3a3ca34..d0e1c0832713 100644 --- a/src/Monitor/Monitor.sln +++ b/src/Monitor/Monitor.sln @@ -5,64 +5,63 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{EAA233B5-64B2-4DB0-991A-DD490E0B252B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{99E9B517-1C84-47CA-8364-F4F1C25EC656}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{99E9B517-1C84-47CA-8364-F4F1C25EC656}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{515B67FA-011D-4114-B476-B814F716F158}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{515B67FA-011D-4114-B476-B814F716F158}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{1304DFB0-29F5-4F7C-BB03-FF0EE7E5E5A2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{1304DFB0-29F5-4F7C-BB03-FF0EE7E5E5A2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4DEBFCC2-E377-4CFA-8459-F5670417F0C1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4DEBFCC2-E377-4CFA-8459-F5670417F0C1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{39840772-D709-4858-A5FF-C003DDE4C322}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{39840772-D709-4858-A5FF-C003DDE4C322}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{E7AC7E3A-B8F8-485B-ABD4-1406F7C43782}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{E7AC7E3A-B8F8-485B-ABD4-1406F7C43782}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{3F76A15C-B128-4A31-A887-05E303CF8D7F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependentModules", "DependentModules", "{5E1B5E7C-8C9C-47AD-8F8F-19628E8D1B34}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ApplicationInsights", "..\ApplicationInsights\ApplicationInsights.Autorest\Az.ApplicationInsights.csproj", "{BE7CCFEE-61D5-4F38-8DDA-548DCE8C4923}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ApplicationInsights", "..\ApplicationInsights\ApplicationInsights.Autorest\Az.ApplicationInsights.csproj", "{BE7CCFEE-61D5-4F38-8DDA-548DCE8C4923}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationInsights", "..\ApplicationInsights\ApplicationInsights\ApplicationInsights.csproj", "{6219CD72-2EF8-4905-A293-CFAF4942130F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsights", "..\ApplicationInsights\ApplicationInsights\ApplicationInsights.csproj", "{6219CD72-2EF8-4905-A293-CFAF4942130F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ActionGroup", "ActionGroup.Autorest\Az.ActionGroup.csproj", "{55BCFF14-EE0A-4D14-9294-CE78300ACBE8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ActionGroup", "ActionGroup.Autorest\Az.ActionGroup.csproj", "{55BCFF14-EE0A-4D14-9294-CE78300ACBE8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ActivityLogAlert", "ActivityLogAlert.Autorest\Az.ActivityLogAlert.csproj", "{0B76BAD3-775A-4017-8F0C-1C0F1B8D4518}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ActivityLogAlert", "ActivityLogAlert.Autorest\Az.ActivityLogAlert.csproj", "{0B76BAD3-775A-4017-8F0C-1C0F1B8D4518}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Autoscale", "Autoscale.Autorest\Az.Autoscale.csproj", "{0195E501-0C9A-46CA-A54D-6B9056413593}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Autoscale", "Autoscale.Autorest\Az.Autoscale.csproj", "{0195E501-0C9A-46CA-A54D-6B9056413593}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.DataCollectionRule", "DataCollectionRule.Autorest\Az.DataCollectionRule.csproj", "{CC45538E-D624-4E9F-8900-98E103CF3402}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.DataCollectionRule", "DataCollectionRule.Autorest\Az.DataCollectionRule.csproj", "{CC45538E-D624-4E9F-8900-98E103CF3402}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.DiagnosticSetting", "DiagnosticSetting.Autorest\Az.DiagnosticSetting.csproj", "{DB4B8515-7711-4C57-986D-B8085DB90ADD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.DiagnosticSetting", "DiagnosticSetting.Autorest\Az.DiagnosticSetting.csproj", "{DB4B8515-7711-4C57-986D-B8085DB90ADD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monitor.Test", "Monitor.Test\Monitor.Test.csproj", "{D5C30947-FBD5-4185-8240-7D8527A0C13C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monitor.Test", "Monitor.Test\Monitor.Test.csproj", "{D5C30947-FBD5-4185-8240-7D8527A0C13C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monitor", "Monitor\Monitor.csproj", "{07DBB93E-C011-4AFD-AD30-5E9688A6A026}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monitor", "Monitor\Monitor.csproj", "{07DBB93E-C011-4AFD-AD30-5E9688A6A026}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.MonitorWorkspace", "MonitorWorkspace.Autorest\Az.MonitorWorkspace.csproj", "{FDA456F4-19EC-45AC-A1D7-363D4000EFCD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.MonitorWorkspace", "MonitorWorkspace.Autorest\Az.MonitorWorkspace.csproj", "{FDA456F4-19EC-45AC-A1D7-363D4000EFCD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ScheduledQueryRule", "ScheduledQueryRule.Autorest\Az.ScheduledQueryRule.csproj", "{AA04E3D0-0173-477D-86E8-794DC601F032}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ScheduledQueryRule", "ScheduledQueryRule.Autorest\Az.ScheduledQueryRule.csproj", "{AA04E3D0-0173-477D-86E8-794DC601F032}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network.Management.Sdk", "..\Network\Network.Management.Sdk\Network.Management.Sdk.csproj", "{5A8422A0-17A6-4CC3-8C33-5C44059BA64E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Network.Management.Sdk", "..\Network\Network.Management.Sdk\Network.Management.Sdk.csproj", "{5A8422A0-17A6-4CC3-8C33-5C44059BA64E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network", "..\Network\Network\Network.csproj", "{DE5F414C-83E4-4F3E-9BAC-0D6921873B36}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Network", "..\Network\Network\Network.csproj", "{DE5F414C-83E4-4F3E-9BAC-0D6921873B36}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OperationalInsights", "..\OperationalInsights\OperationalInsights\OperationalInsights.csproj", "{B54BD1A5-F4AB-485B-8478-520B6AA1E9E7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OperationalInsights", "..\OperationalInsights\OperationalInsights\OperationalInsights.csproj", "{B54BD1A5-F4AB-485B-8478-520B6AA1E9E7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{0636EEB2-FE81-4424-8CFC-CCEB25360A40}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{0636EEB2-FE81-4424-8CFC-CCEB25360A40}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Metricdata", "MetricData.Autorest\Az.Metricdata.csproj", "{F95B32A7-D021-418F-9AC3-33D1A3CAE39C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Metricdata", "MetricData.Autorest\Az.Metricdata.csproj", "{F95B32A7-D021-418F-9AC3-33D1A3CAE39C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.PipelineGroup", "PipelineGroup.Autorest\Az.PipelineGroup.csproj", "{25911606-03C7-40C4-AA27-C7F1230040B6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.PipelineGroup", "PipelineGroup.Autorest\Az.PipelineGroup.csproj", "{25911606-03C7-40C4-AA27-C7F1230040B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monitor.Management.Sdk", "Monitor.Management.Sdk\Monitor.Management.Sdk.csproj", "{55719D82-53E9-4CEA-9532-5E72BB0025EA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {99E9B517-1C84-47CA-8364-F4F1C25EC656}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {99E9B517-1C84-47CA-8364-F4F1C25EC656}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -156,6 +155,13 @@ Global {25911606-03C7-40C4-AA27-C7F1230040B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {25911606-03C7-40C4-AA27-C7F1230040B6}.Release|Any CPU.ActiveCfg = Release|Any CPU {25911606-03C7-40C4-AA27-C7F1230040B6}.Release|Any CPU.Build.0 = Release|Any CPU + {55719D82-53E9-4CEA-9532-5E72BB0025EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55719D82-53E9-4CEA-9532-5E72BB0025EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55719D82-53E9-4CEA-9532-5E72BB0025EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55719D82-53E9-4CEA-9532-5E72BB0025EA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {99E9B517-1C84-47CA-8364-F4F1C25EC656} = {EAA233B5-64B2-4DB0-991A-DD490E0B252B} diff --git a/src/Monitor/Monitor/Az.Monitor.psd1 b/src/Monitor/Monitor/Az.Monitor.psd1 index c76fb4e44c21..3829b6acf09b 100644 --- a/src/Monitor/Monitor/Az.Monitor.psd1 +++ b/src/Monitor/Monitor/Az.Monitor.psd1 @@ -62,7 +62,7 @@ RequiredAssemblies = 'ActionGroup.Autorest/bin/Az.ActionGroup.private.dll', 'DataCollectionRule.Autorest/bin/Az.DataCollectionRule.private.dll', 'DiagnosticSetting.Autorest/bin/Az.DiagnosticSetting.private.dll', 'MetricData.Autorest/bin/Az.Metricdata.private.dll', - 'Microsoft.Azure.Management.Monitor.dll', + 'Microsoft.Azure.PowerShell.Monitor.Management.Sdk.dll', 'MonitorWorkspace.Autorest/bin/Az.MonitorWorkspace.private.dll', 'PipelineGroup.Autorest/bin/Az.PipelineGroup.private.dll', 'ScheduledQueryRule.Autorest/bin/Az.ScheduledQueryRule.private.dll' diff --git a/src/Monitor/Monitor/Monitor.csproj b/src/Monitor/Monitor/Monitor.csproj index 7063d72894b9..e343d0a82ac6 100644 --- a/src/Monitor/Monitor/Monitor.csproj +++ b/src/Monitor/Monitor/Monitor.csproj @@ -10,10 +10,10 @@ $(LegacyAssemblyPrefix)Insights + + - + - - diff --git a/src/Monitor/Monitor/OutputClasses/PSActionGroupProperty.cs b/src/Monitor/Monitor/OutputClasses/PSActionGroupProperty.cs deleted file mode 100644 index a1024d35eaa4..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSActionGroupProperty.cs +++ /dev/null @@ -1,116 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Linq; - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - - - /// - /// Wraps around the action group. - /// - public class PSActionGroupProperty : PSManagementPropertyDescriptor - { - /// - /// Gets or sets the action group status. - /// - public string Status { get; set; } - - /// - /// Gets or sets the action group short name. - /// - public string GroupShortName { get; set; } - - /// - /// Gets or sets the list of email receivers. - /// - public IList EmailReceivers { get; set; } - - /// - /// Gets or sets the list of SMS receivers. - /// - public IList SmsReceivers { get; set; } - - /// - /// Gets or sets the list of webhook receviers. - /// - public IList WebhookReceivers { get; set; } - - /// - /// Gets or sets the list of event hub receviers. - /// - public IList EventHubReceivers { get; set; } - - /// - /// Gets or sets the list of itsm receviers. - /// - public IList ItsmReceivers { get; set; } - - /// - /// Gets or sets the list of voice receviers. - /// - public IList VoiceReceivers { get; set; } - - /// - /// Gets or sets the list of armrole receviers. - /// - public IList ArmRoleReceivers { get; set; } - - /// - /// Gets or sets the list of azure function receviers. - /// - public IList AzureFunctionReceivers { get; set; } - - /// - /// Gets or sets the list of logic app receviers. - /// - public IList LogicAppReceivers { get; set; } - - /// - /// Gets or sets the list of automation runbook receviers. - /// - public IList AutomationRunbookReceivers { get; set; } - - /// - /// Gets or sets the list of azure app push receviers. - /// - public IList AzureAppPushReceivers { get; set; } - - - /// - /// Initializes a new instance of the PSActionGroupProperty class. - /// - /// The action group to wrap. - public PSActionGroupProperty(ActionGroupResource actionGroup) - { - this.Status = actionGroup.Enabled ? "Enabled" : "Disabled"; - this.GroupShortName = actionGroup.GroupShortName; - this.EmailReceivers = actionGroup.EmailReceivers.Select(e => new PSEmailReceiver(e)).ToList(); - this.SmsReceivers = actionGroup.SmsReceivers.Select(s => new PSSmsReceiver(s)).ToList(); - this.WebhookReceivers = actionGroup.WebhookReceivers.Select(w => new PSWebhookReceiver(w)).ToList(); - this.EventHubReceivers = actionGroup.EventHubReceivers.Select(w => new PSEventHubReceiver(w)).ToList(); - this.ItsmReceivers = actionGroup.ItsmReceivers.Select(w => new PSItsmReceiver(w)).ToList(); - this.VoiceReceivers = actionGroup.VoiceReceivers.Select(w => new PSVoiceReceiver(w)).ToList(); - this.ArmRoleReceivers = actionGroup.ArmRoleReceivers.Select(w => new PSArmRoleReceiver(w)).ToList(); - this.AzureFunctionReceivers = actionGroup.AzureFunctionReceivers.Select(w => new PSAzureFunctionReceiver(w)).ToList(); - this.LogicAppReceivers = actionGroup.LogicAppReceivers.Select(w => new PSLogicAppReceiver(w)).ToList(); - this.AutomationRunbookReceivers = actionGroup.AutomationRunbookReceivers.Select(w => new PSAutomationRunbookReceiver(w)).ToList(); - this.AzureAppPushReceivers = actionGroup.AzureAppPushReceivers.Select(w => new PSAzureAppPushReceiver(w)).ToList(); - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSActionGroupResource.cs b/src/Monitor/Monitor/OutputClasses/PSActionGroupResource.cs deleted file mode 100644 index b60c77fcd08f..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSActionGroupResource.cs +++ /dev/null @@ -1,150 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - using System.Collections.Generic; - using System.Linq; - - using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; - - /// - /// Wraps around an Action Group. - /// - public class PSActionGroupResource : Resource - { - /// Gets or sets resource group - public string ResourceGroupName { get; set; } - - /// - /// Gets or sets the short name of the action group. This will be used - /// in SMS messages. - /// - /// - public string GroupShortName { get; set; } - - /// - /// Gets or sets indicates whether this action group is enabled. If an - /// action group is not enabled, then none of its receviers will - /// receive communications. - /// - /// - public bool Enabled { get; set; } - - /// - /// Gets or sets the list of email receivers that are part of this - /// action group. - /// - /// - public IList EmailReceivers { get; set; } - - /// - /// Gets or sets the list of SMS receivers that are part of this action - /// group. - /// - /// - public IList SmsReceivers { get; set; } - - /// - /// Gets or sets the list of webhook receivers that are part of this - /// action group. - /// - /// - public IList WebhookReceivers { get; set; } - - /// - /// Gets or sets the list of event hub receivers that are part of this - /// action group. - /// - /// - public IList EventHubReceivers { get; set; } - - /// - /// Gets or sets the list of Itsm receivers that are part of this - /// action group. - /// - /// - public IList ItsmReceivers { get; set; } - - /// - /// Gets or sets the list of voice receivers that are part of this - /// action group. - /// - /// - public IList VoiceReceivers { get; set; } - - /// - /// Gets or sets the list of arm role receivers that are part of this - /// action group. - /// - /// - public IList ArmRoleReceivers { get; set; } - - /// - /// Gets or sets the list of AzureFunctionReceivers that are part of this - /// action group. - /// - /// - public IList AzureFunctionReceivers { get; set; } - - /// - /// Gets or sets the list of LogicAppReceivers that are part of this - /// action group. - /// - /// - public IList LogicAppReceivers { get; set; } - - /// - /// Gets or sets the list of AutomationRunbookReceivers that are part of this - /// action group. - /// - /// - public IList AutomationRunbookReceivers { get; set; } - - /// - /// Gets or sets the list of AzureAppPushReceivers that are part of this - /// action group. - /// - /// - public IList AzureAppPushReceivers { get; set; } - - /// Initializes a new instance of the PSActionGroup class. - /// the action group resource - public PSActionGroupResource(ActionGroupResource actionGroupResource) - : base( - location: actionGroupResource.Location, - id: actionGroupResource.Id, - name: actionGroupResource.Name, - type: actionGroupResource.Type, - tags: actionGroupResource.Tags) - { - this.ResourceGroupName = new ResourceIdentifier(actionGroupResource.Id).ResourceGroupName; - GroupShortName = actionGroupResource.GroupShortName; - Enabled = actionGroupResource.Enabled; - EmailReceivers = actionGroupResource.EmailReceivers?.Select(o => new PSEmailReceiver(o)).ToList(); - SmsReceivers = actionGroupResource.SmsReceivers?.Select(o => new PSSmsReceiver(o)).ToList(); - WebhookReceivers = actionGroupResource.WebhookReceivers?.Select(o => new PSWebhookReceiver(o)).ToList(); - EventHubReceivers = actionGroupResource.EventHubReceivers?.Select(o => new PSEventHubReceiver(o)).ToList(); - ArmRoleReceivers = actionGroupResource.ArmRoleReceivers?.Select(o => new PSArmRoleReceiver(o)).ToList(); - ItsmReceivers = actionGroupResource.ItsmReceivers?.Select(o => new PSItsmReceiver(o)).ToList(); - VoiceReceivers = actionGroupResource.VoiceReceivers?.Select(o => new PSVoiceReceiver(o)).ToList(); - AzureFunctionReceivers = actionGroupResource.AzureFunctionReceivers?.Select(o => new PSAzureFunctionReceiver(o)).ToList(); - LogicAppReceivers = actionGroupResource.LogicAppReceivers?.Select(o => new PSLogicAppReceiver(o)).ToList(); - AutomationRunbookReceivers = actionGroupResource.AutomationRunbookReceivers?.Select(o => new PSAutomationRunbookReceiver(o)).ToList(); - AzureAppPushReceivers = actionGroupResource.AzureAppPushReceivers?.Select(o => new PSAzureAppPushReceiver(o)).ToList(); - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAddActionGroupOperationResponse.cs b/src/Monitor/Monitor/OutputClasses/PSAddActionGroupOperationResponse.cs deleted file mode 100644 index dd0fec54c106..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAddActionGroupOperationResponse.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Adds the newly added resource as part of the response. - /// - public class PSAddActionGroupOperationResponse : AzureOperationResponse - { - /// Gets or sets the action group./ - public PSActionGroupResource ActionGroup { get; set; } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSArmRoleReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSArmRoleReceiver.cs deleted file mode 100644 index d018c345c377..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSArmRoleReceiver.cs +++ /dev/null @@ -1,46 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the ArmRoleReceiver class. - /// - public class PSArmRoleReceiver : PSActionGroupReceiverBase - { - /// Gets or sets the role id of this receiver. - public string RoleId { get; set; } - - /// Gets or sets a value indicating whether or not use common alert schema. - public bool UseCommonAlertSchema { get; set; } - - /// Initializes a new instance of the PSArmRoleReceiver class - public PSArmRoleReceiver() - { - } - - /// - /// Initializes a new instance of the PSArmRoleReceiver class. - /// - /// The receiver to wrap. - public PSArmRoleReceiver(ArmRoleReceiver receiver) - { - this.Name = receiver.Name; - this.RoleId = receiver.RoleId; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAutomationRunbookReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSAutomationRunbookReceiver.cs deleted file mode 100644 index 6036434ca473..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAutomationRunbookReceiver.cs +++ /dev/null @@ -1,62 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the AutomationRunbookReceiver class. - /// - public class PSAutomationRunbookReceiver : PSActionGroupReceiverBase - { - /// Gets or sets automation account identifier - public string AutomationAccountId { get; set; } - - /// Gets or sets the name of the runbook. - public string RunbookName { get; set; } - - /// Gets or sets the name of the webhook resource id. - public string WebhookResourceId { get; set; } - - /// Gets or sets a value indicating whether this instance is global runbook - public bool IsGlobalRunbook { get; set; } - - /// Gets or sets a value indicating whether or not use common alert schema. - public bool UseCommonAlertSchema { get; set; } - - /// Gets or sets the URI where webhooks should be sent.. - public string ServiceUri { get; set; } - - /// Initializes a new instance of the PSAutomationRunbookReceiver class - public PSAutomationRunbookReceiver() - { - } - - /// - /// Initializes a new instance of the PSAutomationRunbookReceiver class. - /// - /// The receiver to wrap. - public PSAutomationRunbookReceiver(AutomationRunbookReceiver receiver) - { - this.Name = receiver.Name; - this.AutomationAccountId = receiver.AutomationAccountId; - this.RunbookName = receiver.RunbookName; - this.WebhookResourceId = receiver.WebhookResourceId; - this.IsGlobalRunbook = receiver.IsGlobalRunbook; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - this.ServiceUri = receiver.ServiceUri; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAutoscaleProfilesList.cs b/src/Monitor/Monitor/OutputClasses/PSAutoscaleProfilesList.cs deleted file mode 100644 index 5849475486bf..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAutoscaleProfilesList.cs +++ /dev/null @@ -1,37 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around a list of AutoscaleProfile - /// - public class PSAutoscaleProfilesList : List - { - /// - /// Initializes a new instance of the PSAutoscaleProfilesList class. - /// - /// - public PSAutoscaleProfilesList(IList profiles) - { - if (profiles != null) - { - this.AddRange(profiles); - } - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAutoscaleSetting.cs b/src/Monitor/Monitor/OutputClasses/PSAutoscaleSetting.cs deleted file mode 100644 index 5fddce7f9f0d..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAutoscaleSetting.cs +++ /dev/null @@ -1,39 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around the AutoscaleSettingGetResponse and AutoscaleSettingResource - /// - public class PSAutoscaleSetting : Management.Monitor.Management.Models.AutoscaleSettingResource - { - /// - /// Gets or sets the AutoscaleSettingResourceName of the object. - /// This property hides a property of the super class for it not to be displayed since it is in the process of deprecation - /// - private new string AutoscaleSettingResourceName { get; set; } - - /// - /// Initializes a new instance of the PSAutoscaleSetting class. - /// - /// The autoscale setting spec - public PSAutoscaleSetting(AutoscaleSettingResource autoscaleSettingSpec) - : base(autoscaleSettingSpec) - { - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAutoscaleSettingNoDetails.cs b/src/Monitor/Monitor/OutputClasses/PSAutoscaleSettingNoDetails.cs deleted file mode 100644 index 46e6253c71b0..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAutoscaleSettingNoDetails.cs +++ /dev/null @@ -1,33 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around the AutoscaleSettingGetResponse and AutoscaleSettingResource - /// - public sealed class PSAutoscaleSettingNoDetails : PSAutoscaleSetting - { - /// - /// Initializes a new instance of the PSAutoscaleSetting class. - /// - /// The autoscale setting spec - public PSAutoscaleSettingNoDetails(AutoscaleSettingResource autoscaleSettingSpec) - : base(autoscaleSettingSpec) - { - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAzureAppPushReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSAzureAppPushReceiver.cs deleted file mode 100644 index 5641857ea8c9..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAzureAppPushReceiver.cs +++ /dev/null @@ -1,45 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Insights.TransitionalClasses; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the AzureAppPushReceiver class. - /// - public class PSAzureAppPushReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the receiver's address. - /// - public string EmailAddress { get; set; } - - /// Initializes a new instance of the PSAzureAppPushReceiver class - public PSAzureAppPushReceiver() - { - } - - /// - /// Initializes a new instance of the PSAzureAppPushReceiver class. - /// - /// The receiver to wrap. - public PSAzureAppPushReceiver(AzureAppPushReceiver receiver) - { - this.Name = receiver.Name; - this.EmailAddress = receiver.EmailAddress; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSAzureFunctionReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSAzureFunctionReceiver.cs deleted file mode 100644 index db2ca48326ca..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSAzureFunctionReceiver.cs +++ /dev/null @@ -1,60 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the AzureFunctionReceiver class. - /// - public class PSAzureFunctionReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the function app resourceId. - /// - public string FunctionAppResourceId { get; set; } - - /// - /// Gets or sets the function name - /// - public string FunctionName { get; set; } - - /// - /// Gets or sets the httpTriggerUrl. - /// - public string HttpTriggerUrl { get; set; } - - /// Gets or sets a value indicating whether or not use common alert schema. - public bool UseCommonAlertSchema { get; set; } - - /// Initializes a new instance of the PSAzureFunctionReceiver class - public PSAzureFunctionReceiver() - { - } - - /// - /// Initializes a new instance of the PSAzureFunctionReceiver class. - /// - /// The receiver to wrap. - public PSAzureFunctionReceiver(AzureFunctionReceiver receiver) - { - this.Name = receiver.Name; - this.FunctionAppResourceId = receiver.FunctionAppResourceId; - this.FunctionName = receiver.FunctionName; - this.HttpTriggerUrl = receiver.HttpTriggerUrl; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSDataCollectionRuleResource.cs b/src/Monitor/Monitor/OutputClasses/PSDataCollectionRuleResource.cs deleted file mode 100644 index 3783695791f8..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSDataCollectionRuleResource.cs +++ /dev/null @@ -1,658 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Linq; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - #region DCR - Data Collection Rule Resource - - /// - /// Wraps around an Data Collection Rule. - /// - public class PSDataCollectionRuleResource : Resource - { - #region Properties - /// - /// Gets or sets description of the data collection rule. - /// - 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. - /// - public PSDataCollectionRuleDataSources DataSources { get; set; } - - /// - /// Gets or sets the specification of destinations. - /// - public PSDataCollectionRuleDestinations Destinations { get; set; } - - /// - /// Gets or sets the specification of data flows. - /// - public IList DataFlows { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - public string ProvisioningState { get; private set; } - - /// - /// Gets resource entity tag (ETag). - /// - public new string Etag { get; private set; } - #endregion - - /// - /// Initializes a new instance of the PSDataCollectionRuleResource class. - /// - public PSDataCollectionRuleResource() - { } - - /// - /// Initializes a new instance of the PSDataCollectionRuleResource class. - /// - /// The DataCollectionRuleResource to wrap. - public PSDataCollectionRuleResource(DataCollectionRuleResource dataCollectionRuleResource) - : base( - location: dataCollectionRuleResource.Location, - id: dataCollectionRuleResource.Id, - name: dataCollectionRuleResource.Name, - type: dataCollectionRuleResource.Type, - tags: dataCollectionRuleResource.Tags) - { - Description = dataCollectionRuleResource.Description; - DataSources = dataCollectionRuleResource.DataSources == null ? new PSDataCollectionRuleDataSources() : - new PSDataCollectionRuleDataSources(dataCollectionRuleResource.DataSources); - Destinations = dataCollectionRuleResource.Destinations == null ? new PSDataCollectionRuleDestinations() : - new PSDataCollectionRuleDestinations(dataCollectionRuleResource.Destinations); - DataFlows = dataCollectionRuleResource.DataFlows?.Select(x => new PSDataFlow(x)).ToList(); - ProvisioningState = dataCollectionRuleResource.ProvisioningState; - Etag = dataCollectionRuleResource.Etag; - } - - internal DataCollectionRuleResource ConvertToApiObject() - { - var dcrDefinitionObject = new DataCollectionRuleResource - { - DataSources = new DataCollectionRuleDataSources(), - Destinations = new DataCollectionRuleDestinations(), - DataFlows = new List() - }; - - if (this.DataSources.PerformanceCounters != null && this.DataSources.PerformanceCounters.Count > 0) - { - dcrDefinitionObject.DataSources.PerformanceCounters = this.DataSources.PerformanceCounters.Select(x => new PerfCounterDataSource( - x.Streams, x.SamplingFrequencyInSeconds, x.CounterSpecifiers, x.Name)).ToList(); - } - - if (this.DataSources.WindowsEventLogs != null && this.DataSources.WindowsEventLogs.Count > 0) - { - dcrDefinitionObject.DataSources.WindowsEventLogs = this.DataSources.WindowsEventLogs.Select(x => new WindowsEventLogDataSource( - x.Streams, x.XPathQueries, x.Name)).ToList(); - } - - if (this.DataSources.Syslog != null && this.DataSources.Syslog.Count > 0) - { - dcrDefinitionObject.DataSources.Syslog = this.DataSources.Syslog.Select(x => new SyslogDataSource( - x.Streams, x.FacilityNames, x.LogLevels, x.Name)).ToList(); - } - - if (this.DataSources.Extensions != null && this.DataSources.Extensions.Count > 0) - { - dcrDefinitionObject.DataSources.Extensions = this.DataSources.Extensions.Select(x => new ExtensionDataSource( - x.ExtensionName, x.Streams, x.ExtensionSettings, x.InputDataSources, x.Name)).ToList(); - } - - if (this.Destinations.LogAnalytics != null && this.Destinations.LogAnalytics.Count > 0) - { - dcrDefinitionObject.Destinations.LogAnalytics = this.Destinations.LogAnalytics.Select(x => new LogAnalyticsDestination( - x.WorkspaceResourceId, x.Name)).ToList(); - } - - if (this.Destinations.AzureMonitorMetrics != null) - { - dcrDefinitionObject.Destinations.AzureMonitorMetrics = new DestinationsSpecAzureMonitorMetrics(this.Destinations.AzureMonitorMetrics.Name); - } - - if (this.DataFlows != null && this.DataFlows.Count > 0) - { - dcrDefinitionObject.DataFlows = this.DataFlows.Select(x => new DataFlow( - x.Streams, x.Destinations)).ToList(); - } - - dcrDefinitionObject.Location = this.Location; - dcrDefinitionObject.Description = this.Description; - dcrDefinitionObject.Tags = this.Tags; - - return dcrDefinitionObject; - } - } - - #endregion - - #region DCR's Data Flow - /// - /// Wraps the DataFlow class. - /// - public class PSDataFlow - { - /// - /// Gets or sets list of streams for this data flow. - /// - public IList Streams { get; set; } - - /// - /// Gets or sets list of destinations for this data flow. - /// - public IList Destinations { get; set; } - - /// - /// Initializes a new instance of the PSDataFlow class. - /// - public PSDataFlow() - { } - - /// - /// Initializes a new instance of the PSDataFlow class. - /// - /// The DataFlow to wrap. - public PSDataFlow(DataFlow dataFlow) - { - Streams = dataFlow.Streams?.Select(x => x).ToList(); - Destinations = dataFlow.Destinations?.Select(x => x).ToList(); - } - } - #endregion - - #region DCR's Destinations - /// - /// Wraps the DataCollectionRuleDestinations class. - /// - public class PSDataCollectionRuleDestinations : PSDestinationsSpec - { - /// - /// Initializes a new instance of the PSDataCollectionRuleDestinations class. - /// - public PSDataCollectionRuleDestinations() : base() - { } - - /// - /// Initializes a new instance of the PSDataCollectionRuleDestinations class. - /// - /// The DataCollectionRuleDestinations to wrap. - public PSDataCollectionRuleDestinations(DataCollectionRuleDestinations dataCollectionRuleDestinations) - : base(dataCollectionRuleDestinations) - { } - } - - /// - /// Wraps the DestinationsSpec class. - /// - public class PSDestinationsSpec - { - /// - /// Gets or sets list of Log Analytics destinations. - /// - public IList LogAnalytics { get; set; } - - /// - /// Gets or sets azure Monitor Metrics destination. - /// - public PSDestinationsSpecAzureMonitorMetrics AzureMonitorMetrics { get; set; } - - /// - /// Initializes a new instance of the PSDestinationsSpec class. - /// - public PSDestinationsSpec() - { } - - /// - /// Initializes a new instance of the PSDestinationsSpec class. - /// - /// The DestinationsSpec to wrap. - public PSDestinationsSpec(DestinationsSpec destinationsSpec) - { - LogAnalytics = destinationsSpec.LogAnalytics?.Select(x => new PSLogAnalyticsDestination(x)).ToList(); - AzureMonitorMetrics = destinationsSpec.AzureMonitorMetrics == null ? new PSDestinationsSpecAzureMonitorMetrics() : - new PSDestinationsSpecAzureMonitorMetrics(destinationsSpec.AzureMonitorMetrics); - } - } - - /// - /// Wraps the DestinationsSpecAzureMonitorMetrics class. - /// - public class PSDestinationsSpecAzureMonitorMetrics : PSAzureMonitorMetricsDestination - { - /// - /// Initializes a new instance of the PSDestinationsSpecAzureMonitorMetrics class. - /// - public PSDestinationsSpecAzureMonitorMetrics() : base() - { } - - /// - /// Initializes a new instance of the PSDestinationsSpecAzureMonitorMetrics class. - /// - /// The DestinationsSpecAzureMonitorMetrics to wrap. - public PSDestinationsSpecAzureMonitorMetrics(DestinationsSpecAzureMonitorMetrics destinationsSpecAzureMonitorMetrics) - : base(destinationsSpecAzureMonitorMetrics) - { } - } - - /// - /// Wraps the AzureMonitorMetricsDestination class. - /// - public class PSAzureMonitorMetricsDestination - { - /// - /// 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSAzureMonitorMetricsDestination class. - /// - public PSAzureMonitorMetricsDestination() - { } - - /// - /// Initializes a new instance of the PSAzureMonitorMetricsDestination class. - /// - /// The AzureMonitorMetricsDestination to wrap. - public PSAzureMonitorMetricsDestination(AzureMonitorMetricsDestination azureMonitorMetricsDestination) - { - Name = azureMonitorMetricsDestination.Name; - } - } - - /// - /// Wraps the LogAnalyticsDestination class. - /// - public class PSLogAnalyticsDestination - { - /// - /// Gets or sets the resource ID of the Log Analytics workspace. - /// - 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSLogAnalyticsDestination class. - /// - public PSLogAnalyticsDestination() - { } - - /// - /// Initializes a new instance of the PSLogAnalyticsDestination class. - /// - /// The LogAnalyticsDestination to wrap. - public PSLogAnalyticsDestination(LogAnalyticsDestination logAnalyticsDestination) - { - WorkspaceResourceId = logAnalyticsDestination.WorkspaceResourceId; - Name = logAnalyticsDestination.Name; - } - } - #endregion - - #region DCR's Data Sources - /// - /// Wraps the DataCollectionRuleDataSources class. - /// - public class PSDataCollectionRuleDataSources : PSDataSourcesSpec - { - /// - /// Initializes a new instance of the PSDataCollectionRuleDataSources class. - /// - public PSDataCollectionRuleDataSources() - : base() - { } - - /// - /// Initializes a new instance of the PSDataCollectionRuleDataSources class. - /// - /// The DataCollectionRuleDataSources to wrap. - public PSDataCollectionRuleDataSources(DataCollectionRuleDataSources dataCollectionRuleDataSources) - : base(dataCollectionRuleDataSources) - { } - } - - /// - /// Wraps the DataSourcesSpec class. - /// - public class PSDataSourcesSpec - { - /// - /// Gets or sets the list of performance counter data source - /// configurations. - /// - public IList PerformanceCounters { get; set; } - - /// - /// Gets or sets the list of Windows Event Log data source - /// configurations. - /// - public IList WindowsEventLogs { get; set; } - - /// - /// Gets or sets the list of Syslog data source configurations. - /// - public IList Syslog { get; set; } - - /// - /// Gets or sets the list of Azure VM extension data source - /// configurations. - /// - public IList Extensions { get; set; } - - /// - /// Initializes a new instance of the PSDataSourcesSpec class. - /// - public PSDataSourcesSpec() - { } - - /// - /// Initializes a new instance of the PSDataSourcesSpec class. - /// - /// The DataSourcesSpec to wrap. - public PSDataSourcesSpec(DataSourcesSpec dataSourcesSpec) - { - PerformanceCounters = dataSourcesSpec.PerformanceCounters?.Select(x => new PSPerfCounterDataSource(x)).ToList(); - WindowsEventLogs = dataSourcesSpec.WindowsEventLogs?.Select(x => new PSWindowsEventLogDataSource(x)).ToList(); - Syslog = dataSourcesSpec.Syslog?.Select(x => new PSSyslogDataSource(x)).ToList(); - Extensions = dataSourcesSpec.Extensions?.Select(x => new PSExtensionDataSource(x)).ToList(); - } - } - - /// - /// Wraps the ExtensionDataSource class. - /// - public class PSExtensionDataSource - { - /// - /// 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. - /// - public IList Streams { get; set; } - - /// - /// Gets or sets the name of the VM extension. - /// - public string ExtensionName { get; set; } - - /// - /// Gets or sets the extension settings. The format is specific for - /// particular extension. - /// - public object ExtensionSettings { get; set; } - - /// - /// Gets or sets the input data sources. The format is specific for - /// particular extension. - /// - public IList InputDataSources { 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSExtensionDataSource class. - /// - public PSExtensionDataSource() - { } - - /// - /// Initializes a new instance of the PSExtensionDataSource class. - /// - /// The ExtensionDataSource to wrap. - public PSExtensionDataSource(ExtensionDataSource extensionDataSource) - { - Streams = extensionDataSource.Streams?.Select(x => x).ToList(); - ExtensionName = extensionDataSource.ExtensionName; - ExtensionSettings = extensionDataSource.ExtensionSettings; - Name = extensionDataSource.Name; - } - } - - /// - /// Wraps the SyslogDataSource class. - /// - public class PSSyslogDataSource - { - /// - /// 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. - /// - public IList Streams { get; set; } - - /// - /// Gets or sets the list of facility names. - /// - public IList FacilityNames { get; set; } - - /// - /// Gets or sets the log levels to collect. - /// - 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSSyslogDataSource class. - /// - public PSSyslogDataSource() - { } - - /// - /// Initializes a new instance of the PSSyslogDataSource class. - /// - /// The SyslogDataSource to wrap. - public PSSyslogDataSource(SyslogDataSource syslogDataSource) - { - Streams = syslogDataSource.Streams?.Select(x => x).ToList(); - FacilityNames = syslogDataSource.FacilityNames?.Select(x => x).ToList(); - LogLevels = syslogDataSource.LogLevels?.Select(x => x).ToList(); - Name = syslogDataSource.Name; - } - } - - /// - /// Wraps the WindowsEventLogDataSource class. - /// - public class PSWindowsEventLogDataSource - { - /// - /// 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. - /// - 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' - /// - public string ScheduledTransferPeriod { get; set; } - - /// - /// Gets or sets a list of Windows Event Log queries in XPATH format. - /// - 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSWindowsEventLogDataSource class. - /// - public PSWindowsEventLogDataSource() - { } - - /// - /// Initializes a new instance of the PSWindowsEventLogDataSource class. - /// - /// The WindowsEventLogDataSource to wrap. - public PSWindowsEventLogDataSource(WindowsEventLogDataSource windowsEventLogDataSource) - { - Streams = windowsEventLogDataSource.Streams?.Select(x => x).ToList(); - XPathQueries = windowsEventLogDataSource.XPathQueries?.Select(x => x).ToList(); - Name = windowsEventLogDataSource.Name; - } - } - - /// - /// Wraps the PerfCounterDataSource class. - /// - public class PSPerfCounterDataSource - { - /// - /// 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. - /// - 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' - /// - public string ScheduledTransferPeriod { get; set; } - - /// - /// Gets or sets the number of seconds between consecutive counter - /// measurements (samples). - /// - 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'. - /// - 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. - /// - public string Name { get; set; } - - /// - /// Initializes a new instance of the PSExtensionDataSource class. - /// - public PSPerfCounterDataSource() - { } - - /// - /// Initializes a new instance of the PSExtensionDataSource class. - /// - /// The PerfCounterDataSource to wrap. - public PSPerfCounterDataSource(PerfCounterDataSource perfCounterDataSource) - { - Streams = perfCounterDataSource.Streams?.Select(x => x).ToList(); - SamplingFrequencyInSeconds = (int)perfCounterDataSource.SamplingFrequencyInSeconds; - CounterSpecifiers = perfCounterDataSource.CounterSpecifiers?.Select(x => x).ToList(); - Name = perfCounterDataSource.Name; - } - } - #endregion - - #region (DCR's child resource) Data Collection Rule Associations - - /// - /// Wraps around an Data Collection Rule Association. - /// - public class PSDataCollectionRuleAssociationProxyOnlyResource : ProxyOnlyResource - { - #region Properties - /// - /// Gets or sets description of the association. - /// - public string Description { get; set; } - - /// - /// Gets or sets the resource ID of the data collection rule that is to - /// be associated. - /// - public string DataCollectionRuleId { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - public string ProvisioningState { get; private set; } - - /// - /// Gets resource entity tag (ETag). - /// - public string Etag { get; private set; } - #endregion - - /// - /// Initializes a new instance of the PSDataCollectionRuleAssociationProxyOnlyResource class. - /// - public PSDataCollectionRuleAssociationProxyOnlyResource() - { } - - /// - /// Initializes a new instance of the PSDataCollectionRuleAssociationProxyOnlyResource class. - /// - /// The DataCollectionRuleAssociationProxyOnlyResource to wrap. - public PSDataCollectionRuleAssociationProxyOnlyResource(DataCollectionRuleAssociationProxyOnlyResource dataCollectionRuleAssociationProxyOnlyResource) - : base( - id: dataCollectionRuleAssociationProxyOnlyResource.Id, - name: dataCollectionRuleAssociationProxyOnlyResource.Name, - type: dataCollectionRuleAssociationProxyOnlyResource.Type) - { - Description = dataCollectionRuleAssociationProxyOnlyResource.Description; - ProvisioningState = dataCollectionRuleAssociationProxyOnlyResource.ProvisioningState; - Etag = dataCollectionRuleAssociationProxyOnlyResource.Etag; - DataCollectionRuleId = dataCollectionRuleAssociationProxyOnlyResource.DataCollectionRuleId; - } - } - #endregion -} \ No newline at end of file diff --git a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs deleted file mode 100644 index a0be11e5a6db..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSDiagnosticSettingCategory - { - public string Id { get; private set; } - - public string Name { get; private set; } - - public string Type { get; private set; } - - public PSDiagnosticSettingCategoryType? CategoryType { get; set; } - - public PSDiagnosticSettingCategory() { } - - public PSDiagnosticSettingCategory(DiagnosticSettingsCategoryResource category) - { - this.Id = category?.Id; - this.Name = category?.Name; - this.Type = category?.Type; - if (category != null) - { - switch (category.CategoryType) - { - case Microsoft.Azure.Management.Monitor.Models.CategoryType.Metrics: - this.CategoryType = PSDiagnosticSettingCategoryType.Metrics; - break; - case Microsoft.Azure.Management.Monitor.Models.CategoryType.Logs: - this.CategoryType = PSDiagnosticSettingCategoryType.Logs; - break; - default: - this.CategoryType = null; - break; - } - } - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingOperationResponse.cs b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingOperationResponse.cs deleted file mode 100644 index 7751a91f2f24..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingOperationResponse.cs +++ /dev/null @@ -1,29 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Adds the newly added resource as part of the response - /// - public class PSDiagnosticSettingOperationResponse : AzureOperationResponse - { - /// - /// Gets or sets the DiagnosticSettingsResource - /// - public DiagnosticSettingsResource DiagnosticSettingsResource { get; set; } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSEmailReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSEmailReceiver.cs deleted file mode 100644 index 9f6b2246b5e3..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSEmailReceiver.cs +++ /dev/null @@ -1,57 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Insights.TransitionalClasses; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the EmailReceiver class. - /// - public class PSEmailReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the receiver's address. - /// - public string EmailAddress { get; set; } - - /// - /// Gets or sets the receiver's status. - /// - public Management.Monitor.Management.Models.ReceiverStatus? Status { get; set; } - - /// - /// Gets or set a value indicating whether common alert schema is to be used or not - /// - public bool UseCommonAlertSchema { get; set; } - - /// Initializes a new instance of the PSEmailReceiver class - public PSEmailReceiver() - { - } - - /// - /// Initializes a new instance of the PSEmailReceiver class. - /// - /// The receiver to wrap. - public PSEmailReceiver(EmailReceiver receiver) - { - this.Name = receiver.Name; - this.EmailAddress = receiver.EmailAddress; - this.Status = TransitionHelpers.ConvertNamespace(receiver.Status); - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSEventHubReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSEventHubReceiver.cs deleted file mode 100644 index 5c1c868bde61..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSEventHubReceiver.cs +++ /dev/null @@ -1,61 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// --- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the EventHubReceiver class. - /// - /// - public class PSEventHubReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the SubscriptionId. - /// - public string SubscriptionId { get; set; } - - /// - /// Gets or sets the namespace. - /// - public string EventHubNameSpace { get; set; } - - /// - /// Gets or sets the event hub name. - /// - public string EventHubName { get; set; } - - /// Gets or sets a value indicating whether or not use common alert schema. - public bool UseCommonAlertSchema { get; set; } - - /// Initializes a new instance of the PSEventHubReceiver class - public PSEventHubReceiver() - { - } - - /// - /// Initializes a new instance of the PSEventHubReceiver class. - /// - /// The receiver to wrap. - public PSEventHubReceiver(EventHubReceiver receiver) - { - this.Name = receiver.Name; - this.SubscriptionId = receiver.SubscriptionId; - this.EventHubNameSpace = receiver.EventHubNameSpace; - this.EventHubName = receiver.EventHubName; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSItsmReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSItsmReceiver.cs deleted file mode 100644 index 0f95e3b7461b..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSItsmReceiver.cs +++ /dev/null @@ -1,55 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Insights.TransitionalClasses; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the ItsmReceiver class. - /// - public class PSItsmReceiver : PSActionGroupReceiverBase - { - /// Gets or sets the itsm workspace id of this receiver. - public string WorkspaceId { get; set; } - - /// Gets or sets the itsm connection id of this receiver. - public string ConnectionId { get; set; } - - /// Gets or sets the itsm ticket configuration of this receiver. - public string TicketConfiguration { get; set; } - - /// Gets or sets the itsm region of this receiver. - public string Region { get; set; } - - /// Initializes a new instance of the PSItsmReceiver class - public PSItsmReceiver() - { - } - - /// - /// Initializes a new instance of the PSItsmReceiver class. - /// - /// The receiver to wrap. - public PSItsmReceiver(ItsmReceiver receiver) - { - this.Name = receiver.Name; - this.WorkspaceId = receiver.WorkspaceId; - this.ConnectionId = receiver.ConnectionId; - this.TicketConfiguration = receiver.TicketConfiguration; - this.Region = receiver.Region; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSLogicAppReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSLogicAppReceiver.cs deleted file mode 100644 index ca2e401464ea..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSLogicAppReceiver.cs +++ /dev/null @@ -1,54 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the LogicAppReceiver class. - /// - public class PSLogicAppReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the resourceId. - /// - public string ResourceId { get; set; } - - /// - /// Gets or sets the callbackUrl. - /// - public string CallbackUrl { get; set; } - - /// Gets or sets a value indicating whether or not use common alert schema. - public bool UseCommonAlertSchema { get; set; } - - /// Initializes a new instance of the PSLogicAppReceiver class - public PSLogicAppReceiver() - { - } - - /// - /// Initializes a new instance of the PSLogicAppReceiver class. - /// - /// The receiver to wrap. - public PSLogicAppReceiver(LogicAppReceiver receiver) - { - this.Name = receiver.Name; - this.ResourceId = receiver.ResourceId; - this.CallbackUrl = receiver.CallbackUrl; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs b/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs deleted file mode 100644 index 5b7d56d02cfe..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs +++ /dev/null @@ -1,73 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Text; -using System.Xml; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around the MetricSettings - /// - public class PSMetricSettings : PSDiagnosticDetailSettings - { - /// - /// Initializes a new instance of the PSMetricSettings class. - /// - public PSMetricSettings(MetricSettings metricSettings) - { - if (metricSettings != null) - { - this.Category = metricSettings.Category; - this.Enabled = metricSettings.Enabled; - this.RetentionPolicy = new PSRetentionPolicy(metricSettings.RetentionPolicy); - this.TimeGrain = metricSettings.TimeGrain ?? default(System.TimeSpan); - } - this.CategoryType = PSDiagnosticSettingCategoryType.Metrics; - } - - public PSMetricSettings() - { - } - - public System.TimeSpan TimeGrain { get; set; } - - /// - /// A string representation of the PSMetricSettings - /// - /// A string representation of the PSMetricSettings - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine(); - output.AppendLine("Category : " + Category); - output.AppendLine("Enabled : " + Enabled); - output.AppendLine("TimeGrain : " + XmlConvert.ToString((System.TimeSpan)TimeGrain)); - output.Append("RetentionPolicy : " + RetentionPolicy.ToString(1)); - return output.ToString(); - } - - public MetricSettings GetMetricSetting() - { - return new MetricSettings() - { - Enabled = this.Enabled, - Category = this.Category, - RetentionPolicy = this.RetentionPolicy, - TimeGrain = this.TimeGrain - }; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAlertingAction.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAlertingAction.cs deleted file mode 100644 index 9e152990e8e6..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAlertingAction.cs +++ /dev/null @@ -1,26 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - - public class PSScheduledQueryRuleAlertingAction : ScheduledQueryRuleAlertingAction - { - public PSScheduledQueryRuleAlertingAction(Microsoft.Azure.Management.Monitor.Models.AlertingAction alertingAction) - : base(alertingAction: alertingAction) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAznsAction.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAznsAction.cs deleted file mode 100644 index 72c8553f6d08..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleAznsAction.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleAznsAction : ScheduledQueryRuleAznsAction - { - public PSScheduledQueryRuleAznsAction(Microsoft.Azure.Management.Monitor.Models.AzNsActionGroup azNsAction) - : base(azNsActionGroup: azNsAction) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleLogMetricTrigger.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleLogMetricTrigger.cs deleted file mode 100644 index 69b9f2ade06c..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleLogMetricTrigger.cs +++ /dev/null @@ -1,29 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Text; - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleLogMetricTrigger : ScheduledQueryRuleLogMetricTrigger - { - public PSScheduledQueryRuleLogMetricTrigger(Microsoft.Azure.Management.Monitor.Models.LogMetricTrigger metricTrigger) - : base(metricTrigger: metricTrigger) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleResource.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleResource.cs deleted file mode 100644 index 765947c2f130..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleResource.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleResource : ScheduledQueryRuleResource - { - public PSScheduledQueryRuleResource(Microsoft.Azure.Management.Monitor.Models.LogSearchRuleResource scheduledQueryRule) - : base(logSearchRule: scheduledQueryRule) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSchedule.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSchedule.cs deleted file mode 100644 index ec728f6f1935..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSchedule.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleSchedule : ScheduledQueryRuleSchedule - { - public PSScheduledQueryRuleSchedule(Microsoft.Azure.Management.Monitor.Models.Schedule schedule) - : base(schedule: schedule) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSource.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSource.cs deleted file mode 100644 index 3b6fb3894a16..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleSource.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleSource : ScheduledQueryRuleSource - { - public PSScheduledQueryRuleSource(Microsoft.Azure.Management.Monitor.Models.Source source) - : base(source: source) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleTriggerCondition.cs b/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleTriggerCondition.cs deleted file mode 100644 index 6df22a079457..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSScheduledQueryRuleTriggerCondition.cs +++ /dev/null @@ -1,25 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Management.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - public class PSScheduledQueryRuleTriggerCondition : ScheduledQueryRuleTriggerCondition - { - public PSScheduledQueryRuleTriggerCondition(Microsoft.Azure.Management.Monitor.Models.TriggerCondition triggerCondition) - : base(triggerCondition: triggerCondition) - { } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs b/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs deleted file mode 100644 index 2e7805913417..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs +++ /dev/null @@ -1,86 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; -using System.Collections.Generic; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around the DiagnosticSettings - /// - public class PSServiceDiagnosticSettings : DiagnosticSettingsResource - { - /// - /// Sets or gets the Location of the Diagnostic Setting - /// - public string Location { get; set; } - - /// - /// Sets or gets the Tags of the Diagnostic Setting - /// - public IDictionary Tags { get; set; } - - //public new string Id { get; set; } - - //public new string Name { get; set; } = "service"; - - public PSServiceDiagnosticSettings() { } - - public PSServiceDiagnosticSettings(string id = default(string), string name = default(string)) : base(id, name) - { - } - - /// - /// Initializes a new instance of the PSServiceDiagnosticSettings class. - /// - public PSServiceDiagnosticSettings(DiagnosticSettingsResource serviceDiagnosticSettings) - : base( - name: serviceDiagnosticSettings?.Name, - id: serviceDiagnosticSettings?.Id, - type: serviceDiagnosticSettings?.Type, - metrics: serviceDiagnosticSettings?.Metrics, - logs: serviceDiagnosticSettings?.Logs) - { - if (serviceDiagnosticSettings != null) - { - this.StorageAccountId = serviceDiagnosticSettings.StorageAccountId; - this.EventHubName = serviceDiagnosticSettings.EventHubName; - this.ServiceBusRuleId = serviceDiagnosticSettings.ServiceBusRuleId; - this.EventHubAuthorizationRuleId = serviceDiagnosticSettings.EventHubAuthorizationRuleId; - - if (serviceDiagnosticSettings.Metrics != null) - { - this.Metrics = new List(); - foreach (MetricSettings metricSettings in serviceDiagnosticSettings.Metrics) - { - this.Metrics.Add(metricSettings); - } - } - - if (serviceDiagnosticSettings.Logs != null) - { - this.Logs = new List(); - foreach (LogSettings logSettings in serviceDiagnosticSettings.Logs) - { - this.Logs.Add(logSettings); - } - } - - this.WorkspaceId = serviceDiagnosticSettings.WorkspaceId; - this.LogAnalyticsDestinationType = serviceDiagnosticSettings.LogAnalyticsDestinationType; - } - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSSmsReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSSmsReceiver.cs deleted file mode 100644 index 15556fa23a14..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSSmsReceiver.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the SmsReceiver class. - /// - public class PSSmsReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the receiver's country code. - /// - public string CountryCode { get; set; } - - /// - /// Gets or sets the receiver's phone number. - /// - public string PhoneNumber { get; set; } - - /// - /// Gets or sets the receiver's status. - /// - public Management.Monitor.Management.Models.ReceiverStatus? Status { get; set; } - - /// Initializes a new instance of the PSSmsReceiver class - public PSSmsReceiver() - { - } - - /// - /// Initializes a new instance of the PSSmsReceiver class. - /// - /// The receiver to wrap. - public PSSmsReceiver(SmsReceiver receiver) - { - this.Name = receiver.Name; - this.CountryCode = receiver.CountryCode; - this.PhoneNumber = receiver.PhoneNumber; - this.Status = TransitionalClasses.TransitionHelpers.ConvertNamespace(receiver.Status); - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSTestNotificationDetailsResponse.cs b/src/Monitor/Monitor/OutputClasses/PSTestNotificationDetailsResponse.cs deleted file mode 100644 index afdba2ca2a70..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSTestNotificationDetailsResponse.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; - - /// - /// Wraps around an Action Group. - /// - public class PSTestNotificationDetailsResponse - { - /// Gets or sets the context - public Context Context { get; set; } - - /// Gets or sets the state - public string State { get; set; } - - /// Gets or sets the completedTime - public DateTimeOffset CompletedTime { get; set; } - - /// Gets or sets the createdTime - public DateTimeOffset CreatedTime { get; set; } - - /// Gets or sets the actionDetails - public ICollection ActionDetails { get; set; } - - /// Initializes a new instance of the PSActionGroup class. - /// the action group resource - public PSTestNotificationDetailsResponse(TestNotificationDetailsResponse actionGroupResource) - { - this.Context = actionGroupResource.Context; - this.State = actionGroupResource.State; - this.CreatedTime = DateTime.Parse(actionGroupResource.CreatedTime); - this.CompletedTime = DateTime.Parse(actionGroupResource.CompletedTime); - this.ActionDetails = this.ActionDetails; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSTestNotificationResource.cs b/src/Monitor/Monitor/OutputClasses/PSTestNotificationResource.cs deleted file mode 100644 index abd9f3b73146..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSTestNotificationResource.cs +++ /dev/null @@ -1,141 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - using System.Collections.Generic; - using System.Linq; - - using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; - - /// - /// Wraps around an Action Group. - /// - public class PSTestNotificationResource - { - /// Gets or sets resource group - public string ResourceGroupName { get; set; } - - /// Gets or sets resource group - public string ActionGroupName { get; set; } - - /// - /// Gets or sets the short name of the action group. This will be used - /// in SMS messages. - /// - /// - public string AlertType { get; set; } - - /// - /// Gets or sets the list of email receivers that are part of this - /// action group. - /// - /// - public IList EmailReceivers { get; set; } - - /// - /// Gets or sets the list of SMS receivers that are part of this action - /// group. - /// - /// - public IList SmsReceivers { get; set; } - - /// - /// Gets or sets the list of webhook receivers that are part of this - /// action group. - /// - /// - public IList WebhookReceivers { get; set; } - - /// - /// Gets or sets the list of event hub receivers that are part of this - /// action group. - /// - /// - public IList EventHubReceivers { get; set; } - - /// - /// Gets or sets the list of Itsm receivers that are part of this - /// action group. - /// - /// - public IList ItsmReceivers { get; set; } - - /// - /// Gets or sets the list of voice receivers that are part of this - /// action group. - /// - /// - public IList VoiceReceivers { get; set; } - - /// - /// Gets or sets the list of arm role receivers that are part of this - /// action group. - /// - /// - public IList ArmRoleReceivers { get; set; } - - /// - /// Gets or sets the list of AzureFunctionReceivers that are part of this - /// action group. - /// - /// - public IList AzureFunctionReceivers { get; set; } - - /// - /// Gets or sets the list of LogicAppReceivers that are part of this - /// action group. - /// - /// - public IList LogicAppReceivers { get; set; } - - /// - /// Gets or sets the list of AutomationRunbookReceivers that are part of this - /// action group. - /// - /// - public IList AutomationRunbookReceivers { get; set; } - - /// - /// Gets or sets the list of AzureAppPushReceivers that are part of this - /// action group. - /// - /// - public IList AzureAppPushReceivers { get; set; } - - /// Initializes a new instance of the PSActionGroup class. - /// the action group resource - /// The resource group name. - /// The action group name. - public PSTestNotificationResource(NotificationRequestBody actionGroupResource, string resourceGroupName, string actionGroupName) - { - this.ResourceGroupName = resourceGroupName; - this.ActionGroupName = actionGroupName; - this.AlertType = actionGroupResource.AlertType; - this.EmailReceivers = actionGroupResource.EmailReceivers?.Select(o => new PSEmailReceiver(o)).ToList(); - this.SmsReceivers = actionGroupResource.SmsReceivers?.Select(o => new PSSmsReceiver(o)).ToList(); - this.WebhookReceivers = actionGroupResource.WebhookReceivers?.Select(o => new PSWebhookReceiver(o)).ToList(); - this.EventHubReceivers = actionGroupResource.EventHubReceivers?.Select(o => new PSEventHubReceiver(o)).ToList(); - this.ArmRoleReceivers = actionGroupResource.ArmRoleReceivers?.Select(o => new PSArmRoleReceiver(o)).ToList(); - this.ItsmReceivers = actionGroupResource.ItsmReceivers?.Select(o => new PSItsmReceiver(o)).ToList(); - this.VoiceReceivers = actionGroupResource.VoiceReceivers?.Select(o => new PSVoiceReceiver(o)).ToList(); - this.AzureFunctionReceivers = actionGroupResource.AzureFunctionReceivers?.Select(o => new PSAzureFunctionReceiver(o)).ToList(); - this.LogicAppReceivers = actionGroupResource.LogicAppReceivers?.Select(o => new PSLogicAppReceiver(o)).ToList(); - this.AutomationRunbookReceivers = actionGroupResource.AutomationRunbookReceivers?.Select(o => new PSAutomationRunbookReceiver(o)).ToList(); - this.AzureAppPushReceivers = actionGroupResource.AzureAppPushReceivers?.Select(o => new PSAzureAppPushReceiver(o)).ToList(); - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSThresholdRuleCondition.cs b/src/Monitor/Monitor/OutputClasses/PSThresholdRuleCondition.cs deleted file mode 100644 index ca58a73b5d54..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSThresholdRuleCondition.cs +++ /dev/null @@ -1,80 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; -using System; -using System.Text; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wrapps around the ThresholdRuleCondition class - /// - public class PSThresholdRuleCondition : IPSRuleCondition - { - /// - /// Gets or sets the DataSource of the rule condition - /// - public RuleMetricDataSource DataSource { get; set; } - - /// - /// Gets or sets the Operator of the rule condition - /// - public ConditionOperator Operator { get; set; } - - /// - /// Gets or sets the Threshold of the rule condition - /// - public double Threshold { get; set; } - - /// - /// Gets or sets the TimeAggregation operator of the rule condition - /// - public TimeAggregationOperator? TimeAggregation { get; set; } - - /// - /// Gets or sets the WindowSize of the rule condition - /// - public TimeSpan? WindowsSize { get; set; } - - /// - /// Initializes a new instance of the PSThresholdRuleCondition class - /// - /// The rule condition - public PSThresholdRuleCondition(ThresholdRuleCondition ruleCondition) - { - this.DataSource = ruleCondition.DataSource as RuleMetricDataSource; - this.Operator = ruleCondition.OperatorProperty; - this.Threshold = ruleCondition.Threshold; - this.TimeAggregation = ruleCondition.TimeAggregation; - this.WindowsSize = ruleCondition.WindowSize; - } - - /// - /// A string representation of the object - /// - /// - public override string ToString() - { - StringBuilder output = new StringBuilder(); - output.AppendLine(); - output.AppendLine(" DataSource : " + this.DataSource.ToString(indentationTabs: 2)); - output.AppendLine(" Operator : " + this.Operator); - output.AppendLine(" Threshold : " + this.Threshold); - output.AppendLine(" Aggregation operator: " + this.TimeAggregation); - output.Append(" Window size : " + this.WindowsSize); - return output.ToString(); - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSVoiceReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSVoiceReceiver.cs deleted file mode 100644 index 09248c91b76f..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSVoiceReceiver.cs +++ /dev/null @@ -1,47 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Insights.TransitionalClasses; -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the VoiceReceiver class. - /// - public class PSVoiceReceiver : PSActionGroupReceiverBase - { - /// Gets or sets the country code. - public string CountryCode { get; set; } - - /// Gets or sets the phone number. - public string PhoneNumber { get; set; } - - /// Initializes a new instance of the PSVoiceReceiver class - public PSVoiceReceiver() - { - } - - /// - /// Initializes a new instance of the PSVoiceReceiver class. - /// - /// The receiver to wrap. - public PSVoiceReceiver(VoiceReceiver receiver) - { - this.Name = receiver.Name; - this.CountryCode = receiver.CountryCode; - this.PhoneNumber = receiver.PhoneNumber; - } - } -} diff --git a/src/Monitor/Monitor/OutputClasses/PSWebhookReceiver.cs b/src/Monitor/Monitor/OutputClasses/PSWebhookReceiver.cs deleted file mode 100644 index 4328de9e035a..000000000000 --- a/src/Monitor/Monitor/OutputClasses/PSWebhookReceiver.cs +++ /dev/null @@ -1,74 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Management.Monitor.Models; - -namespace Microsoft.Azure.Commands.Insights.OutputClasses -{ - /// - /// Wraps the WebhookReceiver class. - /// - public class PSWebhookReceiver : PSActionGroupReceiverBase - { - /// - /// Gets or sets the receiver's service uri. - /// - public string ServiceUri { get; set; } - - /// - /// Gets or set a value indicating whether common alert schema is to be used or not - /// - public bool UseCommonAlertSchema { get; set; } - - /// - /// Gets or sets a value indicating whether or not use AAD authentication. - /// - public bool UseAadAuth { get; set; } - - /// - /// Gets or sets the webhook app object Id for aad auth. - /// - public string ObjectId { get; set; } - - /// - /// Gets or sets the Identifier uri for aad auth. - /// - public string IdentifierUri { get; set; } - - /// - /// Gets or sets the tenant id for aad auth. - /// - public string TenantId { get; set; } - - /// Initializes a new instance of the PSWebhookReceiver class - public PSWebhookReceiver() - { - } - - /// - /// Initializes a new instance of the PSWebhookReceiver class. - /// - /// The receiver to wrap. - public PSWebhookReceiver(WebhookReceiver receiver) - { - this.Name = receiver.Name; - this.ServiceUri = receiver.ServiceUri; - this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false; - this.UseAadAuth = receiver.UseAadAuth ?? false; - this.ObjectId = receiver.ObjectId; - this.IdentifierUri = receiver.IdentifierUri; - this.TenantId = receiver.TenantId; - } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/MetricSettings.cs b/src/Monitor/Monitor/TransitionalClasses/MetricSettings.cs deleted file mode 100644 index 0eb67653aa7a..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/MetricSettings.cs +++ /dev/null @@ -1,53 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - /// - /// This class is intended to help in the transition between namespaces, since it will be a breaking change that needs to be announced and delayed 6 months. - /// It is identical to the MetricSettings, but in the old namespace - /// - public class MetricSettings : Monitor.Models.MetricSettings - { - /// - /// Gets or sets the RetentionPolicy of the MetricSettings - /// - public new RetentionPolicy RetentionPolicy { get; set; } - - /// - /// Gets or sets the TimeGrain of the MetricSettings - /// - public new TimeSpan TimeGrain { get; set; } - - /// - /// Initializes a new instance of the MetricSettings class. - /// - /// The metric settings - public MetricSettings(Monitor.Models.MetricSettings metricSettings) - : base() - { - if (metricSettings != null) - { - this.Enabled = metricSettings.Enabled; - this.Category = metricSettings.Category; - base.RetentionPolicy = metricSettings.RetentionPolicy; - base.TimeGrain = metricSettings.TimeGrain; - this.RetentionPolicy = metricSettings.RetentionPolicy != null ? new RetentionPolicy(metricSettings.RetentionPolicy) : null; - this.TimeGrain = metricSettings.TimeGrain ?? default(TimeSpan); - } - } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAlertingAction.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAlertingAction.cs deleted file mode 100644 index e78b121e48d8..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAlertingAction.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleAlertingAction : Monitor.Models.AlertingAction - { - public ScheduledQueryRuleAlertingAction() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleAlertingAction class. - /// - /// Specifiy action need to be taken when rule type is Alert - public ScheduledQueryRuleAlertingAction(Monitor.Models.AlertingAction alertingAction) : - base( - severity: alertingAction.Severity, - aznsAction: alertingAction.AznsAction, - trigger: alertingAction.Trigger, - throttlingInMin: alertingAction.ThrottlingInMin) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAznsAction.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAznsAction.cs deleted file mode 100644 index 0b23e4eecb80..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleAznsAction.cs +++ /dev/null @@ -1,33 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleAznsAction : Monitor.Models.AzNsActionGroup - { - public ScheduledQueryRuleAznsAction() : base() - { } - /// - /// Initializes a new instance of the AznsAction class. - /// - /// The AzNs Details - public ScheduledQueryRuleAznsAction(Monitor.Models.AzNsActionGroup azNsActionGroup) : - base( - actionGroup: azNsActionGroup?.ActionGroup, - emailSubject: azNsActionGroup?.EmailSubject, - customWebhookPayload: azNsActionGroup?.CustomWebhookPayload) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleMetricTrigger.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleMetricTrigger.cs deleted file mode 100644 index 5e2373529499..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleMetricTrigger.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleLogMetricTrigger : Monitor.Models.LogMetricTrigger - { - public ScheduledQueryRuleLogMetricTrigger() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleLogMetricTrigger class. - /// - /// The Log Metric Trigger Details - public ScheduledQueryRuleLogMetricTrigger(Monitor.Models.LogMetricTrigger metricTrigger) : - base( - thresholdOperator: metricTrigger?.ThresholdOperator, - threshold: metricTrigger?.Threshold, - metricTriggerType: metricTrigger?.MetricTriggerType, - metricColumn: metricTrigger?.MetricColumn) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleResource.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleResource.cs deleted file mode 100644 index 1a915753e22c..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleResource.cs +++ /dev/null @@ -1,42 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleResource : Monitor.Models.LogSearchRuleResource - { - public ScheduledQueryRuleResource() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleSchedule class. - /// - /// Definition of ScheduledQueryRule. - public ScheduledQueryRuleResource(Monitor.Models.LogSearchRuleResource logSearchRule) : - base( - description: logSearchRule.Description, - enabled: logSearchRule.Enabled, - lastUpdatedTime: logSearchRule.LastUpdatedTime, - provisioningState: logSearchRule.ProvisioningState, - source: logSearchRule.Source, - schedule: logSearchRule.Schedule, - action: logSearchRule.Action, - location: logSearchRule.Location, - id: logSearchRule.Id, - name: logSearchRule.Name, - tags: logSearchRule.Tags, - type: logSearchRule.Type) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSchedule.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSchedule.cs deleted file mode 100644 index 3a98a7242985..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSchedule.cs +++ /dev/null @@ -1,32 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleSchedule : Monitor.Models.Schedule - { - public ScheduledQueryRuleSchedule() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleSchedule class. - /// - /// Defines how often to run the search and the time interval. - public ScheduledQueryRuleSchedule(Monitor.Models.Schedule schedule) : - base( - frequencyInMinutes: schedule.FrequencyInMinutes, - timeWindowInMinutes: schedule.TimeWindowInMinutes) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSource.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSource.cs deleted file mode 100644 index e2ac0403570c..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleSource.cs +++ /dev/null @@ -1,38 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - /// - /// This class is intended to help in the transition between namespaces, since it will be a breaking change that needs to be announced and delayed 6 months. - /// It is identical to the Source, but in the old namespace - /// - public class ScheduledQueryRuleSource : Monitor.Models.Source - { - public ScheduledQueryRuleSource() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleSource class. - /// - /// The Source of the ScheduledQueryRule object - public ScheduledQueryRuleSource(Monitor.Models.Source source) : - base( - query: source?.Query, - dataSourceId: source?.DataSourceId, - authorizedResources: source?.AuthorizedResources, - queryType: source?.QueryType) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleTriggerCondition.cs b/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleTriggerCondition.cs deleted file mode 100644 index d6cb696f4382..000000000000 --- a/src/Monitor/Monitor/TransitionalClasses/ScheduledQueryRuleTriggerCondition.cs +++ /dev/null @@ -1,33 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -namespace Microsoft.Azure.Management.Monitor.Management.Models -{ - public class ScheduledQueryRuleTriggerCondition : Monitor.Models.TriggerCondition - { - public ScheduledQueryRuleTriggerCondition() : base() - { } - /// - /// Initializes a new instance of the ScheduledQueryRuleTriggerCondition class. - /// - /// The condition that results in the Log Search rule. - public ScheduledQueryRuleTriggerCondition(Monitor.Models.TriggerCondition triggerCondition) : - base( - thresholdOperator: triggerCondition.ThresholdOperator, - threshold: triggerCondition.Threshold, - metricTrigger: triggerCondition.MetricTrigger) - { } - } -} diff --git a/src/Monitor/Monitor/TransitionalClasses/TransitionHelpers.cs b/src/Monitor/Monitor/TransitionalClasses/TransitionHelpers.cs index 89591688f531..52e9c2ff9711 100644 --- a/src/Monitor/Monitor/TransitionalClasses/TransitionHelpers.cs +++ b/src/Monitor/Monitor/TransitionalClasses/TransitionHelpers.cs @@ -179,28 +179,6 @@ static public Management.Monitor.Management.Models.RuleDataSource ToMirrorNamesp return null; } - static public Management.Monitor.Management.Models.ReceiverStatus? ConvertNamespace(ReceiverStatus? operatorType) - { - if (operatorType.HasValue) - { - int value = (int)operatorType; - return (Management.Monitor.Management.Models.ReceiverStatus)value; - } - - return null; - } - - static public ReceiverStatus? ConvertNamespace(Management.Monitor.Management.Models.ReceiverStatus? operatorType) - { - if (operatorType.HasValue) - { - int value = (int)operatorType; - return (ReceiverStatus)value; - } - - return null; - } - static public Management.Monitor.Management.Models.TimeAggregationOperator? ConvertNamespace(TimeAggregationOperator? operatorType) { if (operatorType.HasValue) From a69572712c35eff49ce0bd043a8189ec503c4d9c Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:01:14 +0800 Subject: [PATCH 2/8] generate autorest powershell renaming and fix --- .../Generated/ActivityLogsOperations.cs | 223 ++--- .../ActivityLogsOperationsExtensions.cs | 174 ++-- .../Generated/AlertRulesOperations.cs | 676 ++++++++------ .../AlertRulesOperationsExtensions.cs | 433 ++++----- .../Generated/AutoscaleSettingsOperations.cs | 830 +++++++++-------- .../AutoscaleSettingsOperationsExtensions.cs | 553 ++++++----- .../Generated/BaselinesOperations.cs | 152 +-- .../BaselinesOperationsExtensions.cs | 242 +++-- .../Generated/DiagnosticSettingsOperations.cs | 392 ++++---- .../DiagnosticSettingsOperationsExtensions.cs | 299 +++--- .../Generated/EventCategoriesOperations.cs | 115 +-- .../EventCategoriesOperationsExtensions.cs | 74 +- .../Generated/IActivityLogsOperations.cs | 56 +- .../Generated/IAlertRulesOperations.cs | 87 +- .../Generated/IAutoscaleSettingsOperations.cs | 109 ++- .../Generated/IBaselinesOperations.cs | 70 +- .../IDiagnosticSettingsOperations.cs | 69 +- .../Generated/IEventCategoriesOperations.cs | 36 +- .../Generated/ILogProfilesOperations.cs | 70 +- .../Generated/IMetricAlertsOperations.cs | 82 +- .../IMetricAlertsStatusOperations.cs | 38 +- .../Generated/IMetricDefinitionsOperations.cs | 27 +- .../Generated/IMetricNamespacesOperations.cs | 27 +- .../Generated/IMetricsOperations.cs | 50 +- .../Generated/IMonitorManagementClient.cs | 72 +- .../IPrivateEndpointConnectionsOperations.cs | 81 +- .../IPrivateLinkResourcesOperations.cs | 58 +- ...ivateLinkScopeOperationStatusOperations.cs | 30 +- .../IPrivateLinkScopedResourcesOperations.cs | 79 +- .../Generated/IPrivateLinkScopesOperations.cs | 126 ++- .../Generated/LogProfilesOperations.cs | 543 ++++++----- .../LogProfilesOperationsExtensions.cs | 324 +++---- .../Generated/MetricAlertsOperations.cs | 664 ++++++++------ .../MetricAlertsOperationsExtensions.cs | 429 ++++----- .../Generated/MetricAlertsStatusOperations.cs | 239 ++--- .../MetricAlertsStatusOperationsExtensions.cs | 173 ++-- .../Generated/MetricDefinitionsOperations.cs | 115 +-- .../MetricDefinitionsOperationsExtensions.cs | 90 +- .../Generated/MetricNamespacesOperations.cs | 115 +-- .../MetricNamespacesOperationsExtensions.cs | 94 +- .../Generated/MetricsOperations.cs | 149 +-- .../Generated/MetricsOperationsExtensions.cs | 219 +++-- .../Generated/Models/AggregationType.cs | 33 +- .../Generated/Models/AggregationTypeEnum.cs | 13 +- .../Generated/Models/AlertRule.cs | 146 +++ .../Generated/Models/AlertRuleResource.cs | 169 ++-- .../Models/AlertRuleResourcePatch.cs | 157 ++-- .../Generated/Models/AutoscaleNotification.cs | 48 +- .../Generated/Models/AutoscaleProfile.cs | 124 ++- .../Generated/Models/AutoscaleSetting.cs | 139 +++ .../Models/AutoscaleSettingResource.cs | 153 ++-- .../Models/AutoscaleSettingResourcePatch.cs | 147 +-- .../Models/AzureMonitorPrivateLinkScope.cs | 94 +- .../AzureMonitorPrivateLinkScopeProperties.cs | 64 ++ .../Generated/Models/BaselineMetadata.cs | 48 +- .../Generated/Models/BaselineSensitivity.cs | 13 +- .../Models/ComparisonOperationType.cs | 33 +- .../Generated/Models/ConditionOperator.cs | 29 +- .../Generated/Models/CriterionType.cs | 19 + .../Generated/Models/DiagnosticSettings.cs | 135 +++ .../Models/DiagnosticSettingsResource.cs | 165 ++-- .../DiagnosticSettingsResourceCollection.cs | 36 +- .../Generated/Models/DynamicMetricCriteria.cs | 143 +-- .../Models/DynamicThresholdFailingPeriods.cs | 65 +- .../Models/DynamicThresholdOperator.cs | 13 +- .../Models/DynamicThresholdSensitivity.cs | 13 +- .../Generated/Models/EmailNotification.cs | 66 +- .../Generated/Models/ErrorAdditionalInfo.cs | 35 +- .../Generated/Models/ErrorResponse.cs | 36 +- .../Generated/Models/ErrorResponseCommon.cs | 50 +- .../Models/ErrorResponseCommonException.cs | 62 -- .../Models/ErrorResponseException.cs | 25 +- .../Generated/Models/EventData.cs | 436 +++++---- .../Generated/Models/EventLevel.cs | 31 +- .../Generated/Models/HttpRequestInfo.cs | 57 +- .../Generated/Models/LocalizableString.cs | 44 +- .../Models/LocationThresholdRuleCondition.cs | 72 +- .../Generated/Models/LogProfileProperties.cs | 132 +++ .../Generated/Models/LogProfileResource.cs | 160 ++-- .../Models/LogProfileResourcePatch.cs | 149 ++- .../Generated/Models/LogSettings.cs | 66 +- .../ManagementEventAggregationCondition.cs | 69 +- .../Models/ManagementEventRuleCondition.cs | 54 +- .../Generated/Models/MetadataValue.cs | 42 +- .../Generated/Models/Metric.cs | 163 ++-- .../Generated/Models/MetricAlertAction.cs | 48 +- .../Generated/Models/MetricAlertCriteria.cs | 34 +- ...tMultipleResourceMultipleMetricCriteria.cs | 49 +- .../Generated/Models/MetricAlertProperties.cs | 209 +++++ .../Models/MetricAlertPropertiesPatch.cs | 182 ++++ .../Generated/Models/MetricAlertResource.cs | 256 +++--- .../Models/MetricAlertResourcePatch.cs | 222 ++--- ...ertSingleResourceMultipleMetricCriteria.cs | 50 +- .../Generated/Models/MetricAlertStatus.cs | 59 +- .../Models/MetricAlertStatusCollection.cs | 36 +- .../Models/MetricAlertStatusProperties.cs | 59 +- .../Generated/Models/MetricAvailability.cs | 47 +- .../Models/MetricBaselinesProperties.cs | 117 +++ .../Generated/Models/MetricClass.cs | 13 +- .../Generated/Models/MetricCriteria.cs | 86 +- .../Generated/Models/MetricDefinition.cs | 226 ++--- .../Generated/Models/MetricDimension.cs | 72 +- .../Generated/Models/MetricNamespace.cs | 73 +- .../Generated/Models/MetricNamespaceName.cs | 26 +- .../Generated/Models/MetricSettings.cs | 77 +- .../Generated/Models/MetricSingleDimension.cs | 48 +- .../Generated/Models/MetricStatisticType.cs | 31 +- .../Generated/Models/MetricTrigger.cs | 232 ++--- .../Generated/Models/MetricUnit.cs | 13 +- .../Generated/Models/MetricValue.cs | 87 +- .../Generated/Models/MultiMetricCriteria.cs | 120 ++- .../Models/NamespaceClassification.cs | 13 +- .../Generated/Models/Odatatype.cs | 20 + .../Generated/Models/OperationStatus.cs | 78 +- .../Generated/Models/OperationType.cs | 45 + .../Models/{OperatorModel.cs => Operator.cs} | 17 +- .../Generated/Models/Page.cs | 74 +- .../Generated/Models/Page1.cs | 74 +- .../Models/PrivateEndpointConnection.cs | 74 +- .../PrivateEndpointConnectionProperties.cs | 83 ++ .../Models/PrivateEndpointProperty.cs | 25 +- .../Generated/Models/PrivateLinkResource.cs | 58 +- .../Models/PrivateLinkResourceProperties.cs | 58 ++ .../Models/PrivateLinkScopesResource.cs | 84 +- ...ivateLinkServiceConnectionStateProperty.cs | 68 +- .../Generated/Models/ProxyOnlyResource.cs | 49 +- .../Generated/Models/ProxyResource.cs | 49 +- .../Generated/Models/Recurrence.cs | 78 +- .../Generated/Models/RecurrenceFrequency.cs | 37 +- .../Generated/Models/RecurrentSchedule.cs | 259 +++--- .../Generated/Models/Resource.cs | 84 +- .../Generated/Models/Response.cs | 135 +-- .../Generated/Models/ResultType.cs | 25 +- .../Generated/Models/RetentionPolicy.cs | 52 +- .../Generated/Models/RuleAction.cs | 16 +- .../Generated/Models/RuleCondition.cs | 33 +- .../Generated/Models/RuleDataSource.cs | 72 +- .../Generated/Models/RuleEmailAction.cs | 57 +- .../RuleManagementEventClaimsDataSource.cs | 31 +- .../Models/RuleManagementEventDataSource.cs | 151 +-- .../Generated/Models/RuleMetricDataSource.cs | 54 +- .../Generated/Models/RuleWebhookAction.cs | 52 +- .../Generated/Models/ScaleAction.cs | 94 +- .../Generated/Models/ScaleCapacity.cs | 85 +- .../Generated/Models/ScaleDirection.cs | 27 +- .../Generated/Models/ScaleRule.cs | 56 +- .../Models/ScaleRuleMetricDimension.cs | 83 +- .../ScaleRuleMetricDimensionOperationType.cs | 13 +- .../Generated/Models/ScaleType.cs | 29 +- .../Generated/Models/ScopedResource.cs | 55 +- .../Models/ScopedResourceProperties.cs | 58 ++ .../Generated/Models/SenderAuthorization.cs | 52 +- .../Generated/Models/SingleBaseline.cs | 73 +- .../Generated/Models/SingleMetricBaseline.cs | 157 ++-- .../Generated/Models/TagsResource.cs | 29 +- .../Models/ThresholdRuleCondition.cs | 100 +- .../Models/TimeAggregationOperator.cs | 31 +- .../Generated/Models/TimeAggregationType.cs | 33 +- .../Generated/Models/TimeSeriesBaseline.cs | 110 +-- .../Generated/Models/TimeSeriesElement.cs | 56 +- .../Generated/Models/TimeWindow.cs | 210 ++--- .../Generated/Models/WebhookNotification.cs | 41 +- .../WebtestLocationAvailabilityCriteria.cs | 78 +- .../Generated/MonitorManagementClient.cs | 277 +++--- .../PrivateEndpointConnectionsOperations.cs | 586 ++++++------ ...EndpointConnectionsOperationsExtensions.cs | 578 ++++++------ .../PrivateLinkResourcesOperations.cs | 330 ++++--- ...rivateLinkResourcesOperationsExtensions.cs | 246 +++-- ...ivateLinkScopeOperationStatusOperations.cs | 136 +-- ...copeOperationStatusOperationsExtensions.cs | 92 +- .../PrivateLinkScopedResourcesOperations.cs | 576 ++++++------ ...LinkScopedResourcesOperationsExtensions.cs | 582 ++++++------ .../Generated/PrivateLinkScopesOperations.cs | 866 ++++++++++-------- .../PrivateLinkScopesOperationsExtensions.cs | 636 ++++++------- .../SdkInfo_MonitorManagementClient.cs | 43 - src/Monitor/Monitor.Management.Sdk/README.md | 11 +- .../Alerts/AddAzureRmMetricAlertRuleTests.cs | 4 +- .../Alerts/AddAzureRmWebtestAlertRuleTests.cs | 4 +- .../Monitor.Test/ScenarioTests/AlertsTests.cs | 14 +- .../ScenarioTests/AlertsTests.ps1 | 38 +- src/Monitor/Monitor.Test/Utilities.cs | 4 +- .../Alerts/AddAzureRmAlertRuleCommandBase.cs | 2 +- .../AddAzureRmMetricAlertRuleCommand.cs | 2 +- .../AddAzureRmMetricAlertRuleV2Command.cs | 4 +- .../AddAzureRmWebtestAlertRuleCommand.cs | 2 +- .../OutputClasses/PSAlertRuleResource.cs | 2 +- ...tAzureInsightsPrivateLinkScopedResource.cs | 6 +- .../TransitionalClasses/AlertRuleResource.cs | 2 +- .../AutoscaleSettingResource.cs | 2 +- 189 files changed, 12243 insertions(+), 10981 deletions(-) create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRule.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSetting.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScopeProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/CriterionType.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettings.cs delete mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertPropertiesPatch.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricBaselinesProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/Odatatype.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationType.cs rename src/Monitor/Monitor.Management.Sdk/Generated/Models/{OperatorModel.cs => Operator.cs} (77%) create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs create mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResourceProperties.cs delete mode 100644 src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs index 8e4f078e958a..98d81cf3c303 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; 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; /// /// ActivityLogsOperations operations. /// - internal partial class ActivityLogsOperations : IServiceOperations, IActivityLogsOperations + internal partial class ActivityLogsOperations : Microsoft.Rest.IServiceOperations, IActivityLogsOperations { /// /// Initializes a new instance of the ActivityLogsOperations class. @@ -37,13 +24,13 @@ internal partial class ActivityLogsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ActivityLogsOperations(MonitorManagementClient client) + internal ActivityLogsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -55,12 +42,12 @@ internal ActivityLogsOperations(MonitorManagementClient client) /// Provides the list of records from the activity logs. /// /// - /// OData parameters to apply to the operation. + /// /// /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, + /// Used to fetch events with only the given properties.<br>The **$select** + /// argument is a comma separated list of property names to be returned. + /// Possible values are: *authorization*, *claims*, *correlationId*, /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, @@ -72,13 +59,13 @@ internal ActivityLogsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -87,48 +74,54 @@ internal ActivityLogsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string select = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (odataQuery == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "odataQuery"); - } - if (Client.SubscriptionId == null) + + + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("select", select); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _eventData = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_eventData)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_eventData); } } if (apiVersion != null) @@ -144,25 +137,24 @@ internal ActivityLogsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -174,50 +166,51 @@ internal ActivityLogsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -227,9 +220,10 @@ internal ActivityLogsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -240,25 +234,29 @@ internal ActivityLogsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Provides the list of records from the activity logs. /// @@ -271,13 +269,13 @@ internal ActivityLogsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -286,51 +284,54 @@ internal ActivityLogsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -342,50 +343,51 @@ internal ActivityLogsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -395,9 +397,10 @@ internal ActivityLogsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -408,24 +411,28 @@ internal ActivityLogsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs index ed039c9d08e2..39a2c4ac3879 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ActivityLogsOperationsExtensions.cs @@ -1,112 +1,100 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ActivityLogsOperations. + /// Extension methods for ActivityLogsOperations /// public static partial class ActivityLogsOperationsExtensions { - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - public static IPage List(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string)) - { - return operations.ListAsync(odataQuery, select).GetAwaiter().GetResult(); - } + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// Used to fetch events with only the given properties.<br>The **$select** + /// argument is a comma separated list of property names to be returned. + /// Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* + /// + public static Microsoft.Rest.Azure.IPage List(this IActivityLogsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string select = default(string)) + { + return ((IActivityLogsOperations)operations).ListAsync(odataQuery, select).GetAwaiter().GetResult(); + } - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// Used to fetch events with only the given properties.<br>The **$select** + /// argument is a comma separated list of property names to be returned. + /// Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IActivityLogsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string select = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, select, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, select, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IActivityLogsOperations operations, string nextPageLink) + { + return ((IActivityLogsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IActivityLogsOperations operations, string nextPageLink) + /// + /// Provides the list of records from the activity logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IActivityLogsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// 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 IActivityLogsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs index f9008268502c..055ecd41aab8 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// AlertRulesOperations operations. /// - internal partial class AlertRulesOperations : IServiceOperations, IAlertRulesOperations + internal partial class AlertRulesOperations : Microsoft.Rest.IServiceOperations, IAlertRulesOperations { /// /// Initializes a new instance of the AlertRulesOperations class. @@ -36,13 +24,13 @@ internal partial class AlertRulesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AlertRulesOperations(MonitorManagementClient client) + internal AlertRulesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -68,13 +56,13 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -83,68 +71,77 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -154,25 +151,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -184,56 +180,57 @@ internal AlertRulesOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -243,9 +240,10 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -256,16 +254,16 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -274,25 +272,29 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a classic metric alert rule /// @@ -308,10 +310,10 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -320,59 +322,68 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -382,25 +393,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -412,50 +422,51 @@ internal AlertRulesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -465,20 +476,25 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a classic metric alert rule /// @@ -494,13 +510,13 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -509,59 +525,68 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -571,25 +596,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -601,50 +625,51 @@ internal AlertRulesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -654,9 +679,10 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -667,25 +693,29 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates an existing classic metric AlertRuleResource. To update other /// fields use the CreateOrUpdate method. @@ -705,13 +735,13 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -720,64 +750,73 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (alertRulesResource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "alertRulesResource"); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (alertRulesResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertRulesResource"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("alertRulesResource", alertRulesResource); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -787,25 +826,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -817,56 +855,57 @@ internal AlertRulesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(alertRulesResource != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertRulesResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(alertRulesResource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -876,9 +915,10 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -889,16 +929,16 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -907,25 +947,29 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List the classic metric alert rules within a resource group. /// @@ -938,13 +982,13 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -953,53 +997,61 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; 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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1009,25 +1061,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1039,50 +1090,51 @@ internal AlertRulesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1092,9 +1144,10 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1105,25 +1158,29 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List the classic metric alert rules within a subscription. /// @@ -1133,13 +1190,13 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1148,36 +1205,44 @@ internal AlertRulesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; 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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1187,25 +1252,24 @@ internal AlertRulesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1217,50 +1281,51 @@ internal AlertRulesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1270,9 +1335,10 @@ internal AlertRulesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1283,24 +1349,28 @@ internal AlertRulesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs index a803ec871d91..b8408ed19606 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AlertRulesOperationsExtensions.cs @@ -1,260 +1,231 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 AlertRulesOperations. + /// Extension methods for AlertRulesOperations /// public static partial class AlertRulesOperationsExtensions { - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - public static AlertRuleResource CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static AlertRuleResource CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters) + { + return ((IAlertRulesOperations)operations).CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } - /// - /// Deletes a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) + /// + /// Creates or updates a classic metric alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Deletes a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) + { + ((IAlertRulesOperations)operations).DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } - /// - /// Deletes a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - public static AlertRuleResource Get(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) - { - return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } + /// + /// Deletes a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static AlertRuleResource Get(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) + { + return ((IAlertRulesOperations)operations).GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } - /// - /// Gets a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets a classic metric alert rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static AlertRuleResource Update(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource) + { + return ((IAlertRulesOperations)operations).UpdateAsync(resourceGroupName, ruleName, alertRulesResource).GetAwaiter().GetResult(); + } - /// - /// Updates an existing classic metric AlertRuleResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the operation. - /// - public static AlertRuleResource Update(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource) + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, alertRulesResource, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(resourceGroupName, ruleName, alertRulesResource).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// List the classic metric alert rules within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static System.Collections.Generic.IEnumerable ListByResourceGroup(this IAlertRulesOperations operations, string resourceGroupName) + { + return ((IAlertRulesOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } - /// - /// Updates an existing classic metric AlertRuleResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// List the classic metric alert rules within a 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 System.Threading.Tasks.Task> ListByResourceGroupAsync(this IAlertRulesOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, alertRulesResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable ListBySubscription(this IAlertRulesOperations operations) + { + return ((IAlertRulesOperations)operations).ListBySubscriptionAsync().GetAwaiter().GetResult(); + } - /// - /// List the classic metric alert rules within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static IEnumerable ListByResourceGroup(this IAlertRulesOperations operations, string resourceGroupName) + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IAlertRulesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List the classic metric alert rules within a 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 IAlertRulesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscription(this IAlertRulesOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAlertRulesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs index 95b19aa4b48d..31e76ff6ec40 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// AutoscaleSettingsOperations operations. /// - internal partial class AutoscaleSettingsOperations : IServiceOperations, IAutoscaleSettingsOperations + internal partial class AutoscaleSettingsOperations : Microsoft.Rest.IServiceOperations, IAutoscaleSettingsOperations { /// /// Initializes a new instance of the AutoscaleSettingsOperations class. @@ -36,13 +24,13 @@ internal partial class AutoscaleSettingsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AutoscaleSettingsOperations(MonitorManagementClient client) + internal AutoscaleSettingsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -62,13 +50,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -77,53 +65,61 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -133,25 +129,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -163,50 +158,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -216,9 +212,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -229,25 +226,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Creates or updates an autoscale setting. /// @@ -266,13 +267,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -281,68 +282,77 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (autoscaleSettingName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "autoscaleSettingName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -352,25 +362,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -382,56 +391,57 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -441,9 +451,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -454,16 +465,16 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -472,25 +483,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes and autoscale setting /// @@ -506,10 +521,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -518,59 +533,68 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (autoscaleSettingName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "autoscaleSettingName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -580,25 +604,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -610,50 +633,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -663,20 +687,25 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets an autoscale setting /// @@ -692,13 +721,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -707,59 +736,68 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (autoscaleSettingName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "autoscaleSettingName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -769,25 +807,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -799,50 +836,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -852,9 +890,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -865,25 +904,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates an existing AutoscaleSettingsResource. To update other fields use /// the CreateOrUpdate method. @@ -903,13 +946,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -918,64 +961,73 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (autoscaleSettingResource == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "autoscaleSettingResource"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId == null) { - if (Client.SubscriptionId.Length < 1) + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (this.Client.SubscriptionId != null) + { + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (autoscaleSettingName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); - } - if (autoscaleSettingResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingResource"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "autoscaleSettingName"); } + string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("autoscaleSettingResource", autoscaleSettingResource); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -985,25 +1037,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1015,56 +1066,57 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(autoscaleSettingResource != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(autoscaleSettingResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(autoscaleSettingResource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1074,9 +1126,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1087,25 +1140,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the autoscale settings for a subscription /// @@ -1115,13 +1172,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1130,36 +1187,44 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1169,25 +1234,24 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1199,50 +1263,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1252,9 +1317,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1265,25 +1331,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the autoscale settings for a resource group /// @@ -1296,13 +1366,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1311,51 +1381,54 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1367,50 +1440,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1420,9 +1494,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1433,25 +1508,29 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the autoscale settings for a subscription /// @@ -1464,13 +1543,13 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1479,51 +1558,54 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1535,50 +1617,51 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1588,9 +1671,10 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1601,24 +1685,28 @@ internal AutoscaleSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs index e43d0fda5f27..ac5e17bfbad3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/AutoscaleSettingsOperationsExtensions.cs @@ -1,326 +1,297 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 AutoscaleSettingsOperations. + /// Extension methods for AutoscaleSettingsOperations /// public static partial class AutoscaleSettingsOperationsExtensions { - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static IPage ListByResourceGroup(this IAutoscaleSettingsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for a 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 IAutoscaleSettingsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - public static AutoscaleSettingResource CreateOrUpdate(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters).GetAwaiter().GetResult(); - } + /// + /// Lists the autoscale settings for a resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IAutoscaleSettingsOperations operations, string resourceGroupName) + { + return ((IAutoscaleSettingsOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the autoscale settings for a 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 System.Threading.Tasks.Task> ListByResourceGroupAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static AutoscaleSettingResource CreateOrUpdate(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters) + { + return ((IAutoscaleSettingsOperations)operations).CreateOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters).GetAwaiter().GetResult(); + } - /// - /// Deletes and autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - public static void Delete(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) + /// + /// Creates or updates an autoscale setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, parameters, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Deletes and autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static void Delete(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) + { + ((IAutoscaleSettingsOperations)operations).DeleteAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); + } - /// - /// Deletes and autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets an autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - public static AutoscaleSettingResource Get(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) - { - return operations.GetAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); - } + /// + /// Deletes and autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets an autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static AutoscaleSettingResource Get(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) + { + return ((IAutoscaleSettingsOperations)operations).GetAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); + } - /// - /// Gets an autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets an autoscale setting + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + public static AutoscaleSettingResource Update(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) + { + return ((IAutoscaleSettingsOperations)operations).UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).GetAwaiter().GetResult(); + } - /// - /// Updates an existing AutoscaleSettingsResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - public static AutoscaleSettingResource Update(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The autoscale setting name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this IAutoscaleSettingsOperations operations) + { + return ((IAutoscaleSettingsOperations)operations).ListBySubscriptionAsync().GetAwaiter().GetResult(); + } - /// - /// Updates an existing AutoscaleSettingsResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IAutoscaleSettingsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the autoscale settings for a resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IAutoscaleSettingsOperations operations, string nextPageLink) + { + return ((IAutoscaleSettingsOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this IAutoscaleSettingsOperations operations) + /// + /// Lists the autoscale settings for 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this IAutoscaleSettingsOperations operations, string nextPageLink) + { + return ((IAutoscaleSettingsOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAutoscaleSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the autoscale settings for 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 System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - - /// - /// Lists the autoscale settings for 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 IAutoscaleSettingsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for 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 IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IAutoscaleSettingsOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for 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> ListBySubscriptionNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs index 36834d87f796..9b96128c07b3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// BaselinesOperations operations. /// - internal partial class BaselinesOperations : IServiceOperations, IBaselinesOperations + internal partial class BaselinesOperations : Microsoft.Rest.IServiceOperations, IBaselinesOperations { /// /// Initializes a new instance of the BaselinesOperations class. @@ -36,13 +24,13 @@ internal partial class BaselinesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BaselinesOperations(MonitorManagementClient client) + internal BaselinesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -59,14 +47,14 @@ internal BaselinesOperations(MonitorManagementClient client) /// /// The names of the metrics (comma separated) to retrieve. Special case: If a /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** + /// 'Metric,Name1' should be **'Metric%2Name1'** /// /// /// Metric namespace to query metric definitions for. /// /// /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. + /// 'startDateTime_ISO/endDateTime_ISO'. /// /// /// The interval (i.e. timegrain) of the query. @@ -80,22 +68,22 @@ internal BaselinesOperations(MonitorManagementClient client) /// /// The **$filter** is used to reduce the set of metric data returned. Example: /// Metric contains metadata A, B and C. - Return all time series of C where A - /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C - /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' - /// or B = 'b2'** This is invalid because the logical or operator cannot + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot /// separate two different metadata names. - Return all time series where A = - /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - - /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C - /// eq '*'**. Special case: When dimension name or dimension value uses round + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using - /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' - /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 - /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " - /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** /// /// /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' + /// information is retrieved. /// /// /// Headers that will be added to request. @@ -103,13 +91,13 @@ internal BaselinesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -118,20 +106,33 @@ internal BaselinesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + + + + + + + + + string apiVersion = "2019-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("metricnames", metricnames); tracingParameters.Add("metricnamespace", metricnamespace); @@ -142,14 +143,18 @@ internal BaselinesOperations(MonitorManagementClient client) tracingParameters.Add("filter", filter); tracingParameters.Add("resultType", resultType); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; 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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (metricnames != null) { _queryParameters.Add(string.Format("metricnames={0}", System.Uri.EscapeDataString(metricnames))); @@ -164,7 +169,7 @@ internal BaselinesOperations(MonitorManagementClient client) } if (interval != null) { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(interval, this.Client.SerializationSettings).Trim('"')))); } if (aggregation != null) { @@ -180,7 +185,7 @@ internal BaselinesOperations(MonitorManagementClient client) } if (resultType != null) { - _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, this.Client.SerializationSettings).Trim('"')))); } if (apiVersion != null) { @@ -191,25 +196,24 @@ internal BaselinesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -221,50 +225,51 @@ internal BaselinesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -274,9 +279,10 @@ internal BaselinesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -287,24 +293,28 @@ internal BaselinesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs index 3fa0170b488f..4244e8d9a5b6 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/BaselinesOperationsExtensions.cs @@ -1,143 +1,131 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 BaselinesOperations. + /// Extension methods for BaselinesOperations /// public static partial class BaselinesOperationsExtensions { - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. Special case: If a - /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data returned. Example: - /// Metric contains metadata A, B and C. - Return all time series of C where A - /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C - /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' - /// or B = 'b2'** This is invalid because the logical or operator cannot - /// separate two different metadata names. - Return all time series where A = - /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - - /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C - /// eq '*'**. Special case: When dimension name or dimension value uses round - /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using - /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' - /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 - /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " - /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - public static IEnumerable List(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?)) - { - return operations.ListAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).GetAwaiter().GetResult(); - } + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. + /// + public static System.Collections.Generic.IEnumerable List(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?)) + { + return ((IBaselinesOperations)operations).ListAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).GetAwaiter().GetResult(); + } - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. Special case: If a - /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data returned. Example: - /// Metric contains metadata A, B and C. - Return all time series of C where A - /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C - /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' - /// or B = 'b2'** This is invalid because the logical or operator cannot - /// separate two different metadata names. - Return all time series where A = - /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - - /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C - /// eq '*'**. Special case: When dimension name or dimension value uses round - /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using - /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' - /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 - /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " - /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The list of sensitivities (comma separated) to retrieve. + /// + /// + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// + /// + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs index 91eb2f4aa820..3f27e35f4b91 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// DiagnosticSettingsOperations operations. /// - internal partial class DiagnosticSettingsOperations : IServiceOperations, IDiagnosticSettingsOperations + internal partial class DiagnosticSettingsOperations : Microsoft.Rest.IServiceOperations, IDiagnosticSettingsOperations { /// /// Initializes a new instance of the DiagnosticSettingsOperations class. @@ -36,13 +24,13 @@ internal partial class DiagnosticSettingsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal DiagnosticSettingsOperations(MonitorManagementClient client) + internal DiagnosticSettingsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -65,13 +53,13 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -80,36 +68,46 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceUri, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2017-05-01-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -119,25 +117,24 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -149,50 +146,51 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -202,9 +200,10 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -215,50 +214,54 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Creates or updates diagnostic settings for the specified resource. /// /// /// The identifier of the resource. /// - /// - /// Parameters supplied to the operation. - /// /// /// The name of the diagnostic setting. /// + /// + /// Parameters supplied to the operation. + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -267,41 +270,52 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, string name, DiagnosticSettingsResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (resourceUri == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - if (parameters == null) + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2017-05-01-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("name", name); + + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -311,25 +325,24 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -341,56 +354,57 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -400,9 +414,10 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -413,25 +428,29 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes existing diagnostic settings for the specified resource. /// @@ -447,10 +466,10 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -459,36 +478,46 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceUri, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2017-05-01-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("name", name); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -498,25 +527,24 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -528,50 +556,51 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -581,20 +610,25 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the active diagnostic settings list for the specified resource. /// @@ -607,13 +641,13 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -622,30 +656,39 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceUri, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + string apiVersion = "2017-05-01-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/diagnosticSettings").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -655,25 +698,24 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -685,50 +727,51 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -738,9 +781,10 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -751,24 +795,28 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs index b04fabda1b16..86fd8193b3bb 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/DiagnosticSettingsOperationsExtensions.cs @@ -1,182 +1,163 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 DiagnosticSettingsOperations. + /// Extension methods for DiagnosticSettingsOperations /// public static partial class DiagnosticSettingsOperationsExtensions { - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - public static DiagnosticSettingsResource Get(this IDiagnosticSettingsOperations operations, string resourceUri, string name) - { - return operations.GetAsync(resourceUri, name).GetAwaiter().GetResult(); - } - - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + public static DiagnosticSettingsResource Get(this IDiagnosticSettingsOperations operations, string resourceUri, string name) + { + return ((IDiagnosticSettingsOperations)operations).GetAsync(resourceUri, name).GetAwaiter().GetResult(); + } - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - public static DiagnosticSettingsResource CreateOrUpdate(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name) + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(resourceUri, parameters, name).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + public static DiagnosticSettingsResource CreateOrUpdate(this IDiagnosticSettingsOperations operations, string resourceUri, string name, DiagnosticSettingsResource parameters) + { + return ((IDiagnosticSettingsOperations)operations).CreateOrUpdateAsync(resourceUri, name, parameters).GetAwaiter().GetResult(); + } - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Creates or updates diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, DiagnosticSettingsResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceUri, name, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceUri, parameters, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + public static void Delete(this IDiagnosticSettingsOperations operations, string resourceUri, string name) + { + ((IDiagnosticSettingsOperations)operations).DeleteAsync(resourceUri, name).GetAwaiter().GetResult(); + } - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - public static void Delete(this IDiagnosticSettingsOperations operations, string resourceUri, string name) - { - operations.DeleteAsync(resourceUri, name).GetAwaiter().GetResult(); - } + /// + /// Deletes existing diagnostic settings for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the diagnostic setting. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets the active diagnostic settings list for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + public static DiagnosticSettingsResourceCollection List(this IDiagnosticSettingsOperations operations, string resourceUri) + { + return ((IDiagnosticSettingsOperations)operations).ListAsync(resourceUri).GetAwaiter().GetResult(); + } - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets the active diagnostic settings list for the specified resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListAsync(this IDiagnosticSettingsOperations operations, string resourceUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// Gets the active diagnostic settings list for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static DiagnosticSettingsResourceCollection List(this IDiagnosticSettingsOperations operations, string resourceUri) - { - return operations.ListAsync(resourceUri).GetAwaiter().GetResult(); - } - - /// - /// Gets the active diagnostic settings list for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IDiagnosticSettingsOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs index e5b727c56c84..a33e5c652e6e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// EventCategoriesOperations operations. /// - internal partial class EventCategoriesOperations : IServiceOperations, IEventCategoriesOperations + internal partial class EventCategoriesOperations : Microsoft.Rest.IServiceOperations, IEventCategoriesOperations { /// /// Initializes a new instance of the EventCategoriesOperations class. @@ -36,13 +24,13 @@ internal partial class EventCategoriesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal EventCategoriesOperations(MonitorManagementClient client) + internal EventCategoriesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -61,33 +49,47 @@ internal EventCategoriesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + string apiVersion = "2015-04-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Insights/eventcategories").ToString(); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -97,25 +99,24 @@ internal EventCategoriesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -127,50 +128,51 @@ internal EventCategoriesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -180,9 +182,10 @@ internal EventCategoriesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -193,24 +196,28 @@ internal EventCategoriesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs index f4bd0714fd98..ecaa23ac2a76 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/EventCategoriesOperationsExtensions.cs @@ -1,59 +1,47 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 EventCategoriesOperations. + /// Extension methods for EventCategoriesOperations /// public static partial class EventCategoriesOperationsExtensions { - /// - /// Get the list of available event categories supported in the Activity Logs - /// Service.<br>The current list includes the following: Administrative, - /// Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable List(this IEventCategoriesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } + /// + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable List(this IEventCategoriesOperations operations) + { + return ((IEventCategoriesOperations)operations).ListAsync().GetAwaiter().GetResult(); + } - /// - /// Get the list of available event categories supported in the Activity Logs - /// Service.<br>The current list includes the following: Administrative, - /// Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IEventCategoriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IEventCategoriesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs index 79a99a34891e..27ec9e6e6c4a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IActivityLogsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 Microsoft.Rest.Azure.OData; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// ActivityLogsOperations operations. @@ -27,18 +16,20 @@ public partial interface IActivityLogsOperations /// /// Provides the list of records from the activity logs. /// + /// + /// Provides the list of records from the activity logs. + /// /// - /// OData parameters to apply to the operation. + /// /// /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to - /// be returned. Possible values are: *authorization*, *claims*, - /// *correlationId*, *description*, *eventDataId*, *eventName*, - /// *eventTimestamp*, *httpRequest*, *level*, *operationId*, - /// *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, - /// *submissionTimestamp*, *subStatus*, *subscriptionId* + /// Used to fetch events with only the given properties.<br>The **$select** + /// argument is a comma separated list of property names to be returned. + /// Possible values are: *authorization*, *claims*, *correlationId*, + /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, + /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, + /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, + /// *subStatus*, *subscriptionId* /// /// /// The headers that will be added to request. @@ -46,19 +37,20 @@ public partial interface IActivityLogsOperations /// /// 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(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string select = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Provides the list of records from the activity logs. /// + /// + /// Provides the list of records from the activity logs. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -68,15 +60,13 @@ public partial interface IActivityLogsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs index 8cb6ba8bf33c..d44d41c9898d 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IAlertRulesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// AlertRulesOperations operations. @@ -26,6 +16,9 @@ public partial interface IAlertRulesOperations /// /// Creates or updates a classic metric alert rule. /// + /// + /// Creates or updates a classic metric alert rule. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -41,19 +34,20 @@ public partial interface IAlertRulesOperations /// /// 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 ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a classic metric alert rule /// + /// + /// Deletes a classic metric alert rule + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -66,16 +60,17 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets a classic metric alert rule /// + /// + /// Gets a classic metric alert rule + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -88,20 +83,22 @@ public partial interface IAlertRulesOperations /// /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates an existing classic metric AlertRuleResource. To update - /// other fields use the CreateOrUpdate method. + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. /// + /// + /// Updates an existing classic metric AlertRuleResource. To update other + /// fields use the CreateOrUpdate method. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -117,19 +114,20 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List the classic metric alert rules within a resource group. /// + /// + /// List the classic metric alert rules within a resource group. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -139,34 +137,33 @@ public partial interface IAlertRulesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List the classic metric alert rules within a subscription. /// + /// + /// List the classic metric alert rules 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs index 1b889a958070..409a80ba6ab4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IAutoscaleSettingsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// AutoscaleSettingsOperations operations. @@ -26,6 +16,9 @@ public partial interface IAutoscaleSettingsOperations /// /// Lists the autoscale settings for a resource group /// + /// + /// Lists the autoscale settings for a resource group + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -35,19 +28,20 @@ public partial interface IAutoscaleSettingsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Creates or updates an autoscale setting. /// + /// + /// Creates or updates an autoscale setting. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -63,19 +57,20 @@ public partial interface IAutoscaleSettingsOperations /// /// 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 autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes and autoscale setting /// + /// + /// Deletes and autoscale setting + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -88,16 +83,17 @@ public partial interface IAutoscaleSettingsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets an autoscale setting /// + /// + /// Gets an autoscale setting + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -110,20 +106,22 @@ public partial interface IAutoscaleSettingsOperations /// /// 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 autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates an existing AutoscaleSettingsResource. To update other - /// fields use the CreateOrUpdate method. + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. /// + /// + /// Updates an existing AutoscaleSettingsResource. To update other fields use + /// the CreateOrUpdate method. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -139,38 +137,40 @@ public partial interface IAutoscaleSettingsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the autoscale settings for a subscription /// + /// + /// Lists the autoscale settings for 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the autoscale settings for a resource group /// + /// + /// Lists the autoscale settings for a resource group + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -180,19 +180,20 @@ public partial interface IAutoscaleSettingsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the autoscale settings for a subscription /// + /// + /// Lists the autoscale settings for a subscription + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -202,15 +203,13 @@ public partial interface IAutoscaleSettingsOperations /// /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs index 5a76f0c09ee8..b22a226d724f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IBaselinesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// BaselinesOperations operations. @@ -26,20 +16,23 @@ public partial interface IBaselinesOperations /// /// **Lists the metric baseline values for a resource**. /// + /// + /// **Lists the metric baseline values for a resource**. + /// /// /// The identifier of the resource. /// /// - /// The names of the metrics (comma separated) to retrieve. Special - /// case: If a metricname itself has a comma in it then use %2 to - /// indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** /// /// /// Metric namespace to query metric definitions for. /// /// /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. + /// 'startDateTime_ISO/endDateTime_ISO'. /// /// /// The interval (i.e. timegrain) of the query. @@ -51,27 +44,24 @@ public partial interface IBaselinesOperations /// The list of sensitivities (comma separated) to retrieve. /// /// - /// The **$filter** is used to reduce the set of metric data returned. - /// Example: Metric contains metadata A, B and C. - Return all time - /// series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B - /// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A - /// eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid - /// because the logical or operator cannot separate two different - /// metadata names. - Return all time series where A = a1, B = b1 and C - /// = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return - /// all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C - /// eq '*'**. Special case: When dimension name or dimension value uses - /// round brackets. Eg: When dimension name is **dim (test) 1** Instead - /// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim - /// %2528test%2529 1 eq '*' "** When dimension name is **dim (test) 3** - /// and dimension value is **dim3 (test) val** Instead of using - /// $filter= "dim (test) 3 eq 'dim3 (test) val' " use **$filter= "dim - /// %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** + /// The **$filter** is used to reduce the set of metric data returned. Example: + /// Metric contains metadata A, B and C. - Return all time series of C where A + /// = a1 and B = b1 or b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C + /// eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' + /// or B = 'b2'** This is invalid because the logical or operator cannot + /// separate two different metadata names. - Return all time series where A = + /// a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - + /// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C + /// eq '*'**. Special case: When dimension name or dimension value uses round + /// brackets. Eg: When dimension name is **dim (test) 1** Instead of using + /// $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' + /// "** When dimension name is **dim (test) 3** and dimension value is **dim3 + /// (test) val** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " + /// use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** /// /// - /// Allows retrieving only metadata of the baseline. On data request - /// all information is retrieved. Possible values include: 'Data', - /// 'Metadata' + /// Allows retrieving only metadata of the baseline. On data request all + /// information is retrieved. /// /// /// The headers that will be added to request. @@ -79,15 +69,13 @@ public partial interface IBaselinesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs index ed683fb71e30..00da48a77a84 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IDiagnosticSettingsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// DiagnosticSettingsOperations operations. @@ -26,6 +16,9 @@ public partial interface IDiagnosticSettingsOperations /// /// Gets the active diagnostic settings for the specified resource. /// + /// + /// Gets the active diagnostic settings for the specified resource. + /// /// /// The identifier of the resource. /// @@ -38,47 +31,49 @@ public partial interface IDiagnosticSettingsOperations /// /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceUri, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Creates or updates diagnostic settings for the specified resource. /// + /// + /// Creates or updates diagnostic settings for the specified resource. + /// /// /// The identifier of the resource. /// - /// - /// Parameters supplied to the operation. - /// /// /// The name of the diagnostic setting. /// + /// + /// Parameters supplied to the operation. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, string name, DiagnosticSettingsResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes existing diagnostic settings for the specified resource. /// + /// + /// Deletes existing diagnostic settings for the specified resource. + /// /// /// The identifier of the resource. /// @@ -91,17 +86,17 @@ public partial interface IDiagnosticSettingsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceUri, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets the active diagnostic settings list for the specified - /// resource. + /// Gets the active diagnostic settings list for the specified resource. /// + /// + /// Gets the active diagnostic settings list for the specified resource. + /// /// /// The identifier of the resource. /// @@ -111,15 +106,13 @@ public partial interface IDiagnosticSettingsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceUri, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs index 80737e5455ef..e166635c529a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IEventCategoriesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// EventCategoriesOperations operations. @@ -24,26 +14,28 @@ namespace Microsoft.Azure.Management.Monitor public partial interface IEventCategoriesOperations { /// - /// Get the list of available event categories supported in the - /// Activity Logs Service.<br>The current list includes the - /// following: Administrative, Security, ServiceHealth, Alert, - /// Recommendation, Policy. + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. /// + /// + /// Get the list of available event categories supported in the Activity Logs + /// Service.<br>The current list includes the following: Administrative, + /// Security, ServiceHealth, Alert, Recommendation, Policy. + /// /// /// 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)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs index f9d0fa23a80d..9910a552a13f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/ILogProfilesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// LogProfilesOperations operations. @@ -26,6 +16,9 @@ public partial interface ILogProfilesOperations /// /// Deletes the log profile. /// + /// + /// Deletes the log profile. + /// /// /// The name of the log profile. /// @@ -38,13 +31,14 @@ public partial interface ILogProfilesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string logProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets the log profile. /// + /// + /// Gets the log profile. + /// /// /// The name of the log profile. /// @@ -54,19 +48,20 @@ public partial interface ILogProfilesOperations /// /// 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 logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string logProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or update a log profile in Azure Monitoring REST API. /// + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// /// /// The name of the log profile. /// @@ -85,14 +80,16 @@ public partial interface ILogProfilesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates an existing LogProfilesResource. To update other fields use - /// the CreateOrUpdate method. + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. /// + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// /// /// The name of the log profile. /// @@ -105,19 +102,20 @@ public partial interface ILogProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// List the log profiles. /// + /// + /// List the log profiles. + /// /// /// The headers that will be added to request. /// @@ -130,9 +128,7 @@ public partial interface ILogProfilesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs index 9e357c1520d3..5aa2fcb2092c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// MetricAlertsOperations operations. @@ -26,25 +16,29 @@ public partial interface IMetricAlertsOperations /// /// Retrieve alert rule definitions in a subscription. /// + /// + /// Retrieve alert rule definitions in a subscription. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Retrieve alert rule definitions in a resource group. /// + /// + /// Retrieve alert rule definitions in a resource group. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -54,19 +48,20 @@ public partial interface IMetricAlertsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Retrieve an alert rule definition. /// + /// + /// Retrieve an alert rule definition. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -79,19 +74,20 @@ public partial interface IMetricAlertsOperations /// /// 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 ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create or update an metric alert definition. /// + /// + /// Create or update an metric alert definition. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -107,19 +103,20 @@ public partial interface IMetricAlertsOperations /// /// 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 ruleName, MetricAlertResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Update an metric alert definition. /// + /// + /// Update an metric alert definition. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -135,19 +132,20 @@ public partial interface IMetricAlertsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete an alert rule definition. /// + /// + /// Delete an alert rule definition. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -160,12 +158,10 @@ public partial interface IMetricAlertsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs index 3974fcf5e51e..283f6ad72a96 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricAlertsStatusOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// MetricAlertsStatusOperations operations. @@ -26,6 +16,9 @@ public partial interface IMetricAlertsStatusOperations /// /// Retrieve an alert rule status. /// + /// + /// Retrieve an alert rule status. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -38,19 +31,20 @@ public partial interface IMetricAlertsStatusOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Retrieve an alert rule status. /// + /// + /// Retrieve an alert rule status. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -66,15 +60,13 @@ public partial interface IMetricAlertsStatusOperations /// /// 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> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs index 13beb545e854..022cef4e54b2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricDefinitionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// MetricDefinitionsOperations operations. @@ -26,6 +16,9 @@ public partial interface IMetricDefinitionsOperations /// /// Lists the metric definitions for the resource. /// + /// + /// Lists the metric definitions for the resource. + /// /// /// The identifier of the resource. /// @@ -38,15 +31,13 @@ public partial interface IMetricDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs index 79fbc8945262..4b911f390238 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricNamespacesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// MetricNamespacesOperations operations. @@ -26,6 +16,9 @@ public partial interface IMetricNamespacesOperations /// /// Lists the metric namespaces for the resource. /// + /// + /// Lists the metric namespaces for the resource. + /// /// /// The identifier of the resource. /// @@ -39,15 +32,13 @@ public partial interface IMetricNamespacesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs index 26e01b9e62b2..4b2c1c77a01e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMetricsOperations.cs @@ -1,23 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 Microsoft.Rest.Azure.OData; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// MetricsOperations operations. @@ -27,23 +16,26 @@ public partial interface IMetricsOperations /// /// **Lists the metric values for a resource**. /// + /// + /// **Lists the metric values for a resource**. + /// + /// + /// + /// /// /// The identifier of the resource. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. + /// 'startDateTime_ISO/endDateTime_ISO'. /// /// /// The interval (i.e. timegrain) of the query. /// /// - /// The names of the metrics (comma separated) to retrieve. Special - /// case: If a metricname itself has a comma in it then use %2 to - /// indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** /// /// /// The list of aggregation types (comma separated) to retrieve. @@ -54,15 +46,13 @@ public partial interface IMetricsOperations /// Defaults to 10. /// /// - /// The aggregation to use for sorting results and the direction of the - /// sort. + /// The aggregation to use for sorting results and the direction of the sort. /// Only one order can be specified. /// Examples: sum asc. /// /// - /// Reduces the set of data collected. The syntax allowed depends on - /// the operation. See the operation's description for details. - /// Possible values include: 'Data', 'Metadata' + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. /// /// /// Metric namespace to query metric definitions for. @@ -73,15 +63,13 @@ public partial interface IMetricsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs index e41d54c62d81..5a8c3f7c4191 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IMonitorManagementClient.cs @@ -1,24 +1,18 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// Monitor Management Client /// - public partial interface IMonitorManagementClient : System.IDisposable + public partial interface IMonitorManagementClient : System.IDisposable { /// /// The base URI of the service. @@ -28,126 +22,130 @@ public partial interface IMonitorManagementClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - JsonSerializerSettings SerializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - JsonSerializerSettings DeserializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - ServiceClientCredentials Credentials { get; } + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + /// /// The ID of the target subscription. /// - string SubscriptionId { get; set; } + string SubscriptionId { get; set;} + /// /// The preferred language for the response. /// - string AcceptLanguage { get; set; } + string AcceptLanguage { get; set;} + /// /// The retry timeout in seconds for Long Running Operations. Default - /// value is 30. + /// /// value is 30. /// - int? LongRunningOperationRetryTimeout { get; set; } + int? LongRunningOperationRetryTimeout { get; set;} + /// /// Whether a unique x-ms-client-request-id should be generated. When - /// set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. /// - bool? GenerateClientRequestId { get; set; } + bool? GenerateClientRequestId { get; set;} /// - /// Gets the IAutoscaleSettingsOperations. + /// Gets the IAutoscaleSettingsOperations /// IAutoscaleSettingsOperations AutoscaleSettings { get; } /// - /// Gets the IAlertRulesOperations. + /// Gets the IAlertRulesOperations /// IAlertRulesOperations AlertRules { get; } /// - /// Gets the ILogProfilesOperations. + /// Gets the ILogProfilesOperations /// ILogProfilesOperations LogProfiles { get; } /// - /// Gets the IDiagnosticSettingsOperations. + /// Gets the IDiagnosticSettingsOperations /// IDiagnosticSettingsOperations DiagnosticSettings { get; } /// - /// Gets the IActivityLogsOperations. + /// Gets the IActivityLogsOperations /// IActivityLogsOperations ActivityLogs { get; } /// - /// Gets the IEventCategoriesOperations. + /// Gets the IEventCategoriesOperations /// IEventCategoriesOperations EventCategories { get; } /// - /// Gets the IMetricDefinitionsOperations. + /// Gets the IMetricDefinitionsOperations /// IMetricDefinitionsOperations MetricDefinitions { get; } /// - /// Gets the IMetricsOperations. + /// Gets the IMetricsOperations /// IMetricsOperations Metrics { get; } /// - /// Gets the IBaselinesOperations. + /// Gets the IBaselinesOperations /// IBaselinesOperations Baselines { get; } /// - /// Gets the IMetricAlertsOperations. + /// Gets the IMetricAlertsOperations /// IMetricAlertsOperations MetricAlerts { get; } /// - /// Gets the IMetricAlertsStatusOperations. + /// Gets the IMetricAlertsStatusOperations /// IMetricAlertsStatusOperations MetricAlertsStatus { get; } /// - /// Gets the IMetricNamespacesOperations. + /// Gets the IMetricNamespacesOperations /// IMetricNamespacesOperations MetricNamespaces { get; } /// - /// Gets the IPrivateLinkScopesOperations. + /// Gets the IPrivateLinkScopesOperations /// IPrivateLinkScopesOperations PrivateLinkScopes { get; } /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. + /// Gets the IPrivateLinkScopeOperationStatusOperations /// IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IPrivateLinkResourcesOperations /// IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IPrivateEndpointConnectionsOperations /// IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } /// - /// Gets the IPrivateLinkScopedResourcesOperations. + /// Gets the IPrivateLinkScopedResourcesOperations /// IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs index 8c1c483472ce..26639593bee4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateEndpointConnectionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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. @@ -26,6 +16,9 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// Gets a private endpoint connection. /// + /// + /// Gets a private endpoint connection. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -47,13 +40,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Approve or reject a private endpoint connection with a given name. /// + /// + /// Approve or reject a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -64,6 +58,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// The name of the private endpoint connection. /// /// + /// /// /// /// The headers that will be added to request. @@ -77,13 +72,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a private endpoint connection with a given name. /// + /// + /// Deletes a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -102,13 +98,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets all private endpoint connections on a private link scope. /// + /// + /// Gets all private endpoint connections on a private link scope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -127,13 +124,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Approve or reject a private endpoint connection with a given name. /// + /// + /// Approve or reject a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -144,6 +142,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// The name of the private endpoint connection. /// /// + /// /// /// /// The headers that will be added to request. @@ -157,13 +156,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a private endpoint connection with a given name. /// + /// + /// Deletes a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -182,13 +182,14 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets all private endpoint connections on a private link scope. /// + /// + /// Gets all private endpoint connections on a private link scope. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -204,9 +205,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs index 75f9697b3ae9..13ecfc6a66fa 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkResourcesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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. @@ -24,9 +14,13 @@ namespace Microsoft.Azure.Management.Monitor public partial interface IPrivateLinkResourcesOperations { /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. + /// Gets the private link resources that need to be created for a Azure Monitor + /// PrivateLinkScope. /// + /// + /// Gets the private link resources that need to be created for a Azure Monitor + /// PrivateLinkScope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -45,14 +39,16 @@ public partial interface IPrivateLinkResourcesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. + /// Gets the private link resources that need to be created for a Azure Monitor + /// PrivateLinkScope. /// + /// + /// Gets the private link resources that need to be created for a Azure Monitor + /// PrivateLinkScope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -74,14 +70,16 @@ public partial interface IPrivateLinkResourcesOperations /// /// 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)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. + /// Gets the private link resources that need to be created for a Azure Monitor + /// PrivateLinkScope. /// + /// + /// 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. /// @@ -97,9 +95,7 @@ public partial interface IPrivateLinkResourcesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs index 572210155e68..14043cd808a8 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopeOperationStatusOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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. @@ -24,9 +14,13 @@ namespace Microsoft.Azure.Management.Monitor public partial interface IPrivateLinkScopeOperationStatusOperations { /// - /// Get the status of an azure asynchronous operation associated with a - /// private link scope operation. + /// Get the status of an azure asynchronous operation associated with a private + /// link scope operation. /// + /// + /// Get the status of an azure asynchronous operation associated with a private + /// link scope operation. + /// /// /// The operation Id. /// @@ -45,9 +39,7 @@ public partial interface IPrivateLinkScopeOperationStatusOperations /// /// 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)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs index 9d78062ea7b6..7a98d2002cb1 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopedResourcesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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. @@ -26,6 +16,9 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// Gets a scoped resource in a private link scope. /// + /// + /// Gets a scoped resource in a private link scope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -47,13 +40,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Approve or reject a private endpoint connection with a given name. /// + /// + /// Approve or reject a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -78,13 +72,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a private endpoint connection with a given name. /// + /// + /// Deletes a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -103,13 +98,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets all private endpoint connections on a private link scope. /// + /// + /// Gets all private endpoint connections on a private link scope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -128,13 +124,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Approve or reject a private endpoint connection with a given name. /// + /// + /// Approve or reject a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -159,13 +156,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a private endpoint connection with a given name. /// + /// + /// Deletes a private endpoint connection with a given name. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -184,13 +182,14 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets all private endpoint connections on a private link scope. /// + /// + /// Gets all private endpoint connections on a private link scope. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -206,9 +205,7 @@ public partial interface IPrivateLinkScopedResourcesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs index 35aa285c547f..319015629d23 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/IPrivateLinkScopesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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. @@ -24,9 +14,11 @@ namespace Microsoft.Azure.Management.Monitor public partial interface IPrivateLinkScopesOperations { /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. /// + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// /// /// The headers that will be added to request. /// @@ -39,14 +31,14 @@ public partial interface IPrivateLinkScopesOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. + /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. /// + /// + /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -62,13 +54,14 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a Azure Monitor PrivateLinkScope. /// + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -84,13 +77,14 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Returns a Azure Monitor PrivateLinkScope. /// + /// + /// Returns a Azure Monitor PrivateLinkScope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -109,15 +103,18 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You - /// cannot specify a different value for InstrumentationKey nor AppId - /// in the Put operation. + /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. /// + /// + /// 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 is case insensitive. /// @@ -125,8 +122,8 @@ public partial interface IPrivateLinkScopesOperations /// The name of the Azure Monitor PrivateLinkScope resource. /// /// - /// Properties that need to be specified to create or update a Azure - /// Monitor PrivateLinkScope. + /// Properties that need to be specified to create or update a Azure Monitor + /// PrivateLinkScope. /// /// /// The headers that will be added to request. @@ -140,14 +137,16 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates an existing PrivateLinkScope's tags. To update other fields - /// use the CreateOrUpdate method. + /// Updates an existing PrivateLinkScope's tags. To update other fields use the + /// CreateOrUpdate method. /// + /// + /// Updates an existing PrivateLinkScope's tags. To update other fields use the + /// CreateOrUpdate method. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -169,13 +168,14 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a Azure Monitor PrivateLinkScope. /// + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// /// /// The name of the resource group. The name is case insensitive. /// @@ -191,14 +191,14 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. /// + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -214,14 +214,14 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. + /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. /// + /// + /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -237,9 +237,7 @@ public partial interface IPrivateLinkScopesOperations /// /// 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)); + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs index a4dab2af3eb2..259befb1796d 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// LogProfilesOperations operations. /// - internal partial class LogProfilesOperations : IServiceOperations, ILogProfilesOperations + internal partial class LogProfilesOperations : Microsoft.Rest.IServiceOperations, ILogProfilesOperations { /// /// Initializes a new instance of the LogProfilesOperations class. @@ -36,13 +24,13 @@ internal partial class LogProfilesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal LogProfilesOperations(MonitorManagementClient client) + internal LogProfilesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -62,10 +50,10 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -74,42 +62,51 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string logProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (logProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "logProfileName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("logProfileName", logProfileName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -119,25 +116,24 @@ internal LogProfilesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -149,55 +145,56 @@ internal LogProfilesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -207,20 +204,25 @@ internal LogProfilesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the log profile. /// @@ -233,13 +235,13 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -248,42 +250,51 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string logProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (logProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "logProfileName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("logProfileName", logProfileName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -293,25 +304,24 @@ internal LogProfilesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -323,50 +333,51 @@ internal LogProfilesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -376,9 +387,10 @@ internal LogProfilesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -389,25 +401,29 @@ internal LogProfilesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or update a log profile in Azure Monitoring REST API. /// @@ -423,13 +439,13 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -438,51 +454,60 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (logProfileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } if (parameters != null) { parameters.Validate(); } - if (Client.SubscriptionId == null) + if (logProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "logProfileName"); } - if (Client.SubscriptionId != null) + + if (this.Client.SubscriptionId == null) { - if (Client.SubscriptionId.Length < 1) + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (this.Client.SubscriptionId != null) + { + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("logProfileName", logProfileName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -492,25 +517,24 @@ internal LogProfilesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -522,61 +546,62 @@ internal LogProfilesOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -586,9 +611,10 @@ internal LogProfilesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -599,25 +625,29 @@ internal LogProfilesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates an existing LogProfilesResource. To update other fields use the /// CreateOrUpdate method. @@ -634,13 +664,13 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -649,47 +679,56 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (logProfilesResource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "logProfilesResource"); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (logProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } - if (logProfilesResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfilesResource"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "logProfileName"); } + string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("logProfileName", logProfileName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("logProfilesResource", logProfilesResource); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -699,25 +738,24 @@ internal LogProfilesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -729,56 +767,57 @@ internal LogProfilesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(logProfilesResource != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(logProfilesResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(logProfilesResource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -788,9 +827,10 @@ internal LogProfilesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -801,25 +841,29 @@ internal LogProfilesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// List the log profiles. /// @@ -829,13 +873,13 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -844,36 +888,44 @@ internal LogProfilesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2016-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -883,25 +935,24 @@ internal LogProfilesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -913,55 +964,56 @@ internal LogProfilesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -971,9 +1023,10 @@ internal LogProfilesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -984,24 +1037,28 @@ internal LogProfilesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs index 90792ce0a5f1..c9f25bb464d2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/LogProfilesOperationsExtensions.cs @@ -1,202 +1,174 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 LogProfilesOperations. + /// Extension methods for LogProfilesOperations /// public static partial class LogProfilesOperationsExtensions { - /// - /// Deletes the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - public static void Delete(this ILogProfilesOperations operations, string logProfileName) - { - operations.DeleteAsync(logProfileName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - public static LogProfileResource Get(this ILogProfilesOperations operations, string logProfileName) - { - return operations.GetAsync(logProfileName).GetAwaiter().GetResult(); - } + /// + /// Deletes the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static void Delete(this ILogProfilesOperations operations, string logProfileName) + { + ((ILogProfilesOperations)operations).DeleteAsync(logProfileName).GetAwaiter().GetResult(); + } - /// - /// Gets the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - public static LogProfileResource CreateOrUpdate(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters) - { - return operations.CreateOrUpdateAsync(logProfileName, parameters).GetAwaiter().GetResult(); - } + /// + /// Deletes the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ILogProfilesOperations operations, string logProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static LogProfileResource Get(this ILogProfilesOperations operations, string logProfileName) + { + return ((ILogProfilesOperations)operations).GetAsync(logProfileName).GetAwaiter().GetResult(); + } - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets the log profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ILogProfilesOperations operations, string logProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(logProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static LogProfileResource CreateOrUpdate(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters) + { + return ((ILogProfilesOperations)operations).CreateOrUpdateAsync(logProfileName, parameters).GetAwaiter().GetResult(); + } - /// - /// Updates an existing LogProfilesResource. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - public static LogProfileResource Update(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource) + /// + /// Create or update a log profile in Azure Monitoring REST API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(logProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(logProfileName, logProfilesResource).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + public static LogProfileResource Update(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource) + { + return ((ILogProfilesOperations)operations).UpdateAsync(logProfileName, logProfilesResource).GetAwaiter().GetResult(); + } - /// - /// Updates an existing LogProfilesResource. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Updates an existing LogProfilesResource. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the log profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(logProfileName, logProfilesResource, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(logProfileName, logProfilesResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// List the log profiles. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable List(this ILogProfilesOperations operations) + { + return ((ILogProfilesOperations)operations).ListAsync().GetAwaiter().GetResult(); + } - /// - /// List the log profiles. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable List(this ILogProfilesOperations operations) + /// + /// List the log profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ILogProfilesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - return operations.ListAsync().GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// List the log profiles. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ILogProfilesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs index 8cfc97286074..6f1e920f217a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// MetricAlertsOperations operations. /// - internal partial class MetricAlertsOperations : IServiceOperations, IMetricAlertsOperations + internal partial class MetricAlertsOperations : Microsoft.Rest.IServiceOperations, IMetricAlertsOperations { /// /// Initializes a new instance of the MetricAlertsOperations class. @@ -36,13 +24,13 @@ internal partial class MetricAlertsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MetricAlertsOperations(MonitorManagementClient client) + internal MetricAlertsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -59,13 +47,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -74,36 +62,44 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -113,25 +109,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -143,50 +138,51 @@ internal MetricAlertsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -196,9 +192,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -209,25 +206,29 @@ internal MetricAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Retrieve alert rule definitions in a resource group. /// @@ -240,13 +241,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -255,53 +256,61 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -311,25 +320,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -341,50 +349,51 @@ internal MetricAlertsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -394,9 +403,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -407,25 +417,29 @@ internal MetricAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Retrieve an alert rule definition. /// @@ -441,13 +455,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -456,59 +470,68 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -518,25 +541,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -548,50 +570,51 @@ internal MetricAlertsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -601,9 +624,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -614,25 +638,29 @@ internal MetricAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Create or update an metric alert definition. /// @@ -651,13 +679,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -666,68 +694,77 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -737,25 +774,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -767,56 +803,57 @@ internal MetricAlertsOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -826,9 +863,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -839,25 +877,29 @@ internal MetricAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Update an metric alert definition. /// @@ -876,13 +918,13 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -891,64 +933,73 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -958,25 +1009,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -988,56 +1038,57 @@ internal MetricAlertsOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1047,9 +1098,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1060,25 +1112,29 @@ internal MetricAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Delete an alert rule definition. /// @@ -1094,10 +1150,10 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1106,59 +1162,68 @@ internal MetricAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1168,25 +1233,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1198,50 +1262,51 @@ internal MetricAlertsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1251,19 +1316,24 @@ internal MetricAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs index 7784b60e9ce0..24a3c2898474 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsOperationsExtensions.cs @@ -1,258 +1,229 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 MetricAlertsOperations. + /// Extension methods for MetricAlertsOperations /// public static partial class MetricAlertsOperationsExtensions { - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscription(this IMetricAlertsOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IMetricAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve alert rule definitions in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static IEnumerable ListByResourceGroup(this IMetricAlertsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve alert rule definitions in a 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 IMetricAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - public static MetricAlertResource Get(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) - { - return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - public static MetricAlertResource CreateOrUpdate(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable ListBySubscription(this IMetricAlertsOperations operations) + { + return ((IMetricAlertsOperations)operations).ListBySubscriptionAsync().GetAwaiter().GetResult(); + } - /// - /// Create or update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IMetricAlertsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Retrieve alert rule definitions in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static System.Collections.Generic.IEnumerable ListByResourceGroup(this IMetricAlertsOperations operations, string resourceGroupName) + { + return ((IMetricAlertsOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } - /// - /// Update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - public static MetricAlertResource Update(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters) + /// + /// Retrieve alert rule definitions in a 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 System.Threading.Tasks.Task> ListByResourceGroupAsync(this IMetricAlertsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Retrieve an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertResource Get(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) + { + return ((IMetricAlertsOperations)operations).GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } - /// - /// Update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Retrieve an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Create or update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertResource CreateOrUpdate(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters) + { + return ((IMetricAlertsOperations)operations).CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } - /// - /// Delete an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - public static void Delete(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) + /// + /// Create or update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertResource Update(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters) + { + return ((IMetricAlertsOperations)operations).UpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); + } - /// - /// Delete an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Update an metric alert definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Delete an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static void Delete(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) + { + ((IMetricAlertsOperations)operations).DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } + /// + /// Delete an alert rule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs index 5f1a9a47b786..27196ea42405 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// MetricAlertsStatusOperations operations. /// - internal partial class MetricAlertsStatusOperations : IServiceOperations, IMetricAlertsStatusOperations + internal partial class MetricAlertsStatusOperations : Microsoft.Rest.IServiceOperations, IMetricAlertsStatusOperations { /// /// Initializes a new instance of the MetricAlertsStatusOperations class. @@ -36,13 +24,13 @@ internal partial class MetricAlertsStatusOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MetricAlertsStatusOperations(MonitorManagementClient client) + internal MetricAlertsStatusOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -65,13 +53,13 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -80,59 +68,68 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceGroupName, string ruleName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -142,25 +139,24 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -172,50 +168,51 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -225,9 +222,10 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -238,25 +236,29 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Retrieve an alert rule status. /// @@ -275,13 +277,13 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -290,65 +292,75 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (ruleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ruleName"); } + if (statusName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "statusName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "statusName"); } + string apiVersion = "2018-03-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ruleName", ruleName); tracingParameters.Add("statusName", statusName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByName", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByName", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); _url = _url.Replace("{statusName}", System.Uri.EscapeDataString(statusName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -358,25 +370,24 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -388,50 +399,51 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -441,9 +453,10 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -454,24 +467,28 @@ internal MetricAlertsStatusOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs index e5a74a13dd15..898270bd093a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricAlertsStatusOperationsExtensions.cs @@ -1,111 +1,100 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 MetricAlertsStatusOperations. + /// Extension methods for MetricAlertsStatusOperations /// public static partial class MetricAlertsStatusOperationsExtensions { - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - public static MetricAlertStatusCollection List(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName) - { - return operations.ListAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + public static MetricAlertStatusCollection List(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName) + { + return ((IMetricAlertsStatusOperations)operations).ListAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); + } - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + public static MetricAlertStatusCollection ListByName(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName) + { + return ((IMetricAlertsStatusOperations)operations).ListByNameAsync(resourceGroupName, ruleName, statusName).GetAwaiter().GetResult(); + } - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - public static MetricAlertStatusCollection ListByName(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName) + /// + /// Retrieve an alert rule status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the rule. + /// + /// + /// The name of the status. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListByNameAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByNameWithHttpMessagesAsync(resourceGroupName, ruleName, statusName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByNameAsync(resourceGroupName, ruleName, statusName).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - /// - /// The cancellation token. - /// - public static async Task ListByNameAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByNameWithHttpMessagesAsync(resourceGroupName, ruleName, statusName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs index 7e78831dfd41..ad07f252519e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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; /// /// MetricDefinitionsOperations operations. /// - internal partial class MetricDefinitionsOperations : IServiceOperations, IMetricDefinitionsOperations + internal partial class MetricDefinitionsOperations : Microsoft.Rest.IServiceOperations, IMetricDefinitionsOperations { /// /// Initializes a new instance of the MetricDefinitionsOperations class. @@ -36,13 +24,13 @@ internal partial class MetricDefinitionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MetricDefinitionsOperations(MonitorManagementClient client) + internal MetricDefinitionsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -65,13 +53,13 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -80,31 +68,41 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string metricnamespace = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + + string apiVersion = "2018-01-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("metricnamespace", metricnamespace); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metricDefinitions").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -118,25 +116,24 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -148,50 +145,51 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -201,9 +199,10 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -214,24 +213,28 @@ internal MetricDefinitionsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs index b7a408b6ca33..3f85888239be 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricDefinitionsOperationsExtensions.cs @@ -1,67 +1,55 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 MetricDefinitionsOperations. + /// Extension methods for MetricDefinitionsOperations /// public static partial class MetricDefinitionsOperationsExtensions { - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - public static IEnumerable List(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string)) - { - return operations.ListAsync(resourceUri, metricnamespace).GetAwaiter().GetResult(); - } + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + public static System.Collections.Generic.IEnumerable List(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string)) + { + return ((IMetricDefinitionsOperations)operations).ListAsync(resourceUri, metricnamespace).GetAwaiter().GetResult(); + } - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the metric definitions for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnamespace, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnamespace, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs index 8e73a78d2a25..41a7c85a5fe7 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// MetricNamespacesOperations operations. /// - internal partial class MetricNamespacesOperations : IServiceOperations, IMetricNamespacesOperations + internal partial class MetricNamespacesOperations : Microsoft.Rest.IServiceOperations, IMetricNamespacesOperations { /// /// Initializes a new instance of the MetricNamespacesOperations class. @@ -36,13 +24,13 @@ internal partial class MetricNamespacesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MetricNamespacesOperations(MonitorManagementClient client) + internal MetricNamespacesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -66,13 +54,13 @@ internal MetricNamespacesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -81,31 +69,41 @@ internal MetricNamespacesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceUri, string startTime = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + + string apiVersion = "2017-12-01-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("startTime", startTime); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricNamespaces").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -119,25 +117,24 @@ internal MetricNamespacesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -149,50 +146,51 @@ internal MetricNamespacesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -202,9 +200,10 @@ internal MetricNamespacesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -215,24 +214,28 @@ internal MetricNamespacesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs index bf67203b2baf..d41479ad8fe2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricNamespacesOperationsExtensions.cs @@ -1,69 +1,57 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for MetricNamespacesOperations. + /// Extension methods for MetricNamespacesOperations /// public static partial class MetricNamespacesOperationsExtensions { - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - public static IEnumerable List(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string)) - { - return operations.ListAsync(resourceUri, startTime).GetAwaiter().GetResult(); - } + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + public static System.Collections.Generic.IEnumerable List(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string)) + { + return ((IMetricNamespacesOperations)operations).ListAsync(resourceUri, startTime).GetAwaiter().GetResult(); + } - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The ISO 8601 conform Date start time from which to query for metric + /// namespaces. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, startTime, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, startTime, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs index d7369c8dbb9f..1c0e3244f94e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperations.cs @@ -1,32 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; 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; /// /// MetricsOperations operations. /// - internal partial class MetricsOperations : IServiceOperations, IMetricsOperations + internal partial class MetricsOperations : Microsoft.Rest.IServiceOperations, IMetricsOperations { /// /// Initializes a new instance of the MetricsOperations class. @@ -37,13 +24,13 @@ internal partial class MetricsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MetricsOperations(MonitorManagementClient client) + internal MetricsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,15 +41,15 @@ internal MetricsOperations(MonitorManagementClient client) /// /// **Lists the metric values for a resource**. /// + /// + /// + /// /// /// The identifier of the resource. /// - /// - /// OData parameters to apply to the operation. - /// /// /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. + /// 'startDateTime_ISO/endDateTime_ISO'. /// /// /// The interval (i.e. timegrain) of the query. @@ -70,7 +57,7 @@ internal MetricsOperations(MonitorManagementClient client) /// /// The names of the metrics (comma separated) to retrieve. Special case: If a /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** + /// 'Metric,Name1' should be **'Metric%2Name1'** /// /// /// The list of aggregation types (comma separated) to retrieve. @@ -87,8 +74,7 @@ internal MetricsOperations(MonitorManagementClient client) /// /// /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' + /// operation. See the operation's description for details. /// /// /// Metric namespace to query metric definitions for. @@ -99,13 +85,13 @@ internal MetricsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -114,20 +100,34 @@ internal MetricsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + + if (resourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceUri"); } + + + + + + + + + string apiVersion = "2018-01-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceUri", resourceUri); tracingParameters.Add("timespan", timespan); @@ -139,20 +139,24 @@ internal MetricsOperations(MonitorManagementClient client) tracingParameters.Add("resultType", resultType); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("metricnamespace", metricnamespace); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/metrics").ToString(); _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (odataQuery != null) { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) + var _metadataValue = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_metadataValue)) { - _queryParameters.Add(_odataFilter); + _queryParameters.Add(_metadataValue); } } if (timespan != null) @@ -161,7 +165,7 @@ internal MetricsOperations(MonitorManagementClient client) } if (interval != null) { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(interval, this.Client.SerializationSettings).Trim('"')))); } if (metricnames != null) { @@ -173,7 +177,7 @@ internal MetricsOperations(MonitorManagementClient client) } if (top != null) { - _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(top, this.Client.SerializationSettings).Trim('"')))); } if (orderby != null) { @@ -181,7 +185,7 @@ internal MetricsOperations(MonitorManagementClient client) } if (resultType != null) { - _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, this.Client.SerializationSettings).Trim('"')))); } if (apiVersion != null) { @@ -196,25 +200,24 @@ internal MetricsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -226,50 +229,51 @@ internal MetricsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -279,9 +283,10 @@ internal MetricsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -292,24 +297,28 @@ internal MetricsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs index 3be2a5704802..1b2eec6bc3cd 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MetricsOperationsExtensions.cs @@ -1,132 +1,119 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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 Microsoft.Rest.Azure.OData; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for MetricsOperations. + /// Extension methods for MetricsOperations /// public static partial class MetricsOperationsExtensions { - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. Special case: If a - /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - public static Response List(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string)) - { - return operations.ListAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace).GetAwaiter().GetResult(); - } + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The identifier of the resource. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. + /// + /// + /// Metric namespace to query metric definitions for. + /// + public static Response List(this IMetricsOperations operations, string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string)) + { + return ((IMetricsOperations)operations).ListAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace).GetAwaiter().GetResult(); + } - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. Special case: If a - /// metricname itself has a comma in it then use %2 to indicate it. Eg: - /// 'Metric,Name1' should be **'Metric%2Name1'** - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// **Lists the metric values for a resource**. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The identifier of the resource. + /// + /// + /// The timespan of the query. It is a string with the following format + /// 'startDateTime_ISO/endDateTime_ISO'. + /// + /// + /// The interval (i.e. timegrain) of the query. + /// + /// + /// The names of the metrics (comma separated) to retrieve. Special case: If a + /// metricname itself has a comma in it then use %2 to indicate it. Eg: + /// 'Metric,Name1' should be **'Metric%2Name1'** + /// + /// + /// The list of aggregation types (comma separated) to retrieve. + /// + /// + /// The maximum number of records to retrieve. + /// Valid only if $filter is specified. + /// Defaults to 10. + /// + /// + /// The aggregation to use for sorting results and the direction of the sort. + /// Only one order can be specified. + /// Examples: sum asc. + /// + /// + /// Reduces the set of data collected. The syntax allowed depends on the + /// operation. See the operation's description for details. + /// + /// + /// Metric namespace to query metric definitions for. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListAsync(this IMetricsOperations operations, string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs index fed1698e35fb..530cb10000a8 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationType.cs @@ -1,37 +1,30 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for AggregationType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum AggregationType { - [EnumMember(Value = "None")] + [System.Runtime.Serialization.EnumMember(Value = "None")] None, - [EnumMember(Value = "Average")] + [System.Runtime.Serialization.EnumMember(Value = "Average")] Average, - [EnumMember(Value = "Count")] + [System.Runtime.Serialization.EnumMember(Value = "Count")] Count, - [EnumMember(Value = "Minimum")] + [System.Runtime.Serialization.EnumMember(Value = "Minimum")] Minimum, - [EnumMember(Value = "Maximum")] + [System.Runtime.Serialization.EnumMember(Value = "Maximum")] Maximum, - [EnumMember(Value = "Total")] + [System.Runtime.Serialization.EnumMember(Value = "Total")] Total } internal static class AggregationTypeEnumExtension @@ -40,7 +33,6 @@ internal static string ToSerializedValue(this AggregationType? value) { return value == null ? null : ((AggregationType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this AggregationType value) { switch( value ) @@ -60,7 +52,6 @@ internal static string ToSerializedValue(this AggregationType value) } return null; } - internal static AggregationType? ParseAggregationType(this string value) { switch( value ) @@ -81,4 +72,4 @@ internal static string ToSerializedValue(this AggregationType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs index e2007d5c8ddc..00126b2fd663 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AggregationTypeEnum.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for AggregationTypeEnum. /// + + public static class AggregationTypeEnum { public const string Average = "Average"; @@ -22,4 +19,4 @@ public static class AggregationTypeEnum public const string Maximum = "Maximum"; public const string Total = "Total"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRule.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRule.cs new file mode 100644 index 000000000000..87a6b46a8605 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRule.cs @@ -0,0 +1,146 @@ +// 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 System.Linq; + + /// + /// An alert rule. + /// + public partial class AlertRule + { + /// + /// Initializes a new instance of the AlertRule class. + /// + public AlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRule class. + /// + + /// the name of the alert rule. + /// + + /// the description of the alert rule that will be included in the alert email. + /// + + /// the provisioning state. + /// + + /// the flag that indicates whether the alert rule is enabled. + /// + + /// the condition that results in the alert rule being activated. + /// + + /// action that is performed when the alert rule becomes active, and when an + /// alert condition is resolved. + /// + + /// the array of actions that are performed when the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + public AlertRule(string name, bool isEnabled, RuleCondition condition, string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + + { + this.Name = name; + this.Description = description; + this.ProvisioningState = provisioningState; + this.IsEnabled = isEnabled; + this.Condition = condition; + this.Action = action; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the alert rule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the description of the alert rule that will be included in the + /// alert email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the provisioning state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert rule is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isEnabled")] + public bool IsEnabled {get; set; } + + /// + /// Gets or sets the condition that results in the alert rule being activated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "condition")] + public RuleCondition Condition {get; set; } + + /// + /// Gets or sets action that is performed when the alert rule becomes active, + /// and when an alert condition is resolved. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "action")] + public RuleAction Action {get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actions")] + public System.Collections.Generic.IList Actions {get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastUpdatedTime")] + public System.DateTime? LastUpdatedTime {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + if (this.Condition == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Condition"); + } + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs index 6c956147d4a5..f21ebd6fab6c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The alert rule resource. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AlertRuleResource : Resource { /// @@ -34,38 +24,59 @@ public AlertRuleResource() /// /// Initializes a new instance of the AlertRuleResource class. /// - /// Resource location - /// the name of the alert - /// rule. - /// the flag that indicates whether the alert - /// rule is enabled. - /// the condition that results in the alert - /// rule being activated. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the description of the alert rule that - /// will be included in the alert email. - /// the provisioning state. - /// action that is performed when the alert rule - /// becomes active, and when an alert condition is resolved. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public AlertRuleResource(string location, string alertRuleResourceName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) - : base(location, id, name, type, tags) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// Resource tags + /// + + /// the name of the alert rule. + /// + + /// the description of the alert rule that will be included in the alert email. + /// + + /// the provisioning state. + /// + + /// the flag that indicates whether the alert rule is enabled. + /// + + /// the condition that results in the alert rule being activated. + /// + + /// action that is performed when the alert rule becomes active, and when an + /// alert condition is resolved. + /// + + /// the array of actions that are performed when the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + public AlertRuleResource(string location, string propertiesName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + + : base(location, id, name, type, tags) { - AlertRuleResourceName = alertRuleResourceName; - Description = description; - ProvisioningState = provisioningState; - IsEnabled = isEnabled; - Condition = condition; - Action = action; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; + this.PropertiesName = propertiesName; + this.Description = description; + this.ProvisioningState = provisioningState; + this.IsEnabled = isEnabled; + this.Condition = condition; + this.Action = action; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; CustomInit(); } @@ -74,76 +85,80 @@ public AlertRuleResource() /// partial void CustomInit(); + /// /// Gets or sets the name of the alert rule. /// - [JsonProperty(PropertyName = "properties.name")] - public string AlertRuleResourceName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] + public string PropertiesName {get; set; } /// - /// Gets or sets the description of the alert rule that will be - /// included in the alert email. + /// Gets or sets the description of the alert rule that will be included in the + /// alert email. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets the provisioning state. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// - /// Gets or sets the flag that indicates whether the alert rule is - /// enabled. + /// Gets or sets the flag that indicates whether the alert rule is enabled. /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool IsEnabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isEnabled")] + public bool IsEnabled {get; set; } /// - /// Gets or sets the condition that results in the alert rule being - /// activated. + /// Gets or sets the condition that results in the alert rule being activated. /// - [JsonProperty(PropertyName = "properties.condition")] - public RuleCondition Condition { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.condition")] + public RuleCondition Condition {get; set; } /// - /// Gets or sets action that is performed when the alert rule becomes - /// active, and when an alert condition is resolved. + /// Gets or sets action that is performed when the alert rule becomes active, + /// and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.action")] - public RuleAction Action { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.action")] + public RuleAction Action {get; set; } /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.actions")] + public System.Collections.Generic.IList Actions {get; set; } /// /// Gets last time the rule was updated in ISO8601 format. /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (AlertRuleResourceName == null) + if (this.PropertiesName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleResourceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PropertiesName"); } - if (Condition == null) + if (this.Condition == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Condition"); } + + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs index 002d92250887..37e140a74c86 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResourcePatch.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The alert rule object for patch operations. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AlertRuleResourcePatch { /// @@ -34,33 +24,47 @@ public AlertRuleResourcePatch() /// /// Initializes a new instance of the AlertRuleResourcePatch class. /// - /// the name of the alert rule. - /// the flag that indicates whether the alert - /// rule is enabled. - /// the condition that results in the alert - /// rule being activated. - /// Resource tags - /// the description of the alert rule that - /// will be included in the alert email. - /// the provisioning state. - /// action that is performed when the alert rule - /// becomes active, and when an alert condition is resolved. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public AlertRuleResourcePatch(string name, bool isEnabled, RuleCondition condition, IDictionary tags = default(IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + + /// Resource tags + /// + + /// the name of the alert rule. + /// + + /// the description of the alert rule that will be included in the alert email. + /// + + /// the provisioning state. + /// + + /// the flag that indicates whether the alert rule is enabled. + /// + + /// the condition that results in the alert rule being activated. + /// + + /// action that is performed when the alert rule becomes active, and when an + /// alert condition is resolved. + /// + + /// the array of actions that are performed when the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + public AlertRuleResourcePatch(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string name = default(string), string description = default(string), string provisioningState = default(string), bool? isEnabled = default(bool?), RuleCondition condition = default(RuleCondition), RuleAction action = default(RuleAction), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + { - Tags = tags; - Name = name; - Description = description; - ProvisioningState = provisioningState; - IsEnabled = isEnabled; - Condition = condition; - Action = action; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; + this.Tags = tags; + this.Name = name; + this.Description = description; + this.ProvisioningState = provisioningState; + this.IsEnabled = isEnabled; + this.Condition = condition; + this.Action = action; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; CustomInit(); } @@ -69,81 +73,62 @@ public AlertRuleResourcePatch() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// /// Gets or sets the name of the alert rule. /// - [JsonProperty(PropertyName = "properties.name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] + public string Name {get; set; } /// - /// Gets or sets the description of the alert rule that will be - /// included in the alert email. + /// Gets or sets the description of the alert rule that will be included in the + /// alert email. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets the provisioning state. /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } /// - /// Gets or sets the flag that indicates whether the alert rule is - /// enabled. + /// Gets or sets the flag that indicates whether the alert rule is enabled. /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool IsEnabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled {get; set; } /// - /// Gets or sets the condition that results in the alert rule being - /// activated. + /// Gets or sets the condition that results in the alert rule being activated. /// - [JsonProperty(PropertyName = "properties.condition")] - public RuleCondition Condition { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.condition")] + public RuleCondition Condition {get; set; } /// - /// Gets or sets action that is performed when the alert rule becomes - /// active, and when an alert condition is resolved. + /// Gets or sets action that is performed when the alert rule becomes active, + /// and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.action")] - public RuleAction Action { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.action")] + public RuleAction Action {get; set; } /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.actions")] + public System.Collections.Generic.IList Actions {get; set; } /// /// Gets last time the rule was updated in ISO8601 format. /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Condition == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); - } - } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs index 8ac9f845761d..c9b628cffa38 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleNotification.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,13 +23,17 @@ public AutoscaleNotification() /// /// Initializes a new instance of the AutoscaleNotification class. /// - /// the email notification. - /// the collection of webhook - /// notifications. - public AutoscaleNotification(EmailNotification email = default(EmailNotification), IList webhooks = default(IList)) + + /// the email notification. + /// + + /// the collection of webhook notifications. + /// + public AutoscaleNotification(EmailNotification email = default(EmailNotification), System.Collections.Generic.IList webhooks = default(System.Collections.Generic.IList)) + { - Email = email; - Webhooks = webhooks; + this.Email = email; + this.Webhooks = webhooks; CustomInit(); } /// @@ -53,24 +49,22 @@ static AutoscaleNotification() /// partial void CustomInit(); + /// /// Gets or sets the email notification. /// - [JsonProperty(PropertyName = "email")] - public EmailNotification Email { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "email")] + public EmailNotification Email {get; set; } /// /// Gets or sets the collection of webhook notifications. /// - [JsonProperty(PropertyName = "webhooks")] - public IList Webhooks { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "webhooks")] + public System.Collections.Generic.IList Webhooks {get; set; } /// - /// the operation associated with the notification and its value must - /// be "scale" + /// Gets or sets the operation associated with the notification and its value must be "scale" /// - [JsonProperty(PropertyName = "operation")] - public static string Operation { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public static string Operation {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs index ac0e4a09c11f..65a76268b0f3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleProfile.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,24 +23,32 @@ public AutoscaleProfile() /// /// Initializes a new instance of the AutoscaleProfile class. /// - /// the name of the profile. - /// the number of instances that can be used - /// during this profile. - /// the collection of rules that provide the - /// triggers and parameters for the scaling action. A maximum of 10 - /// rules can be specified. - /// the specific date-time for the profile. - /// This element is not used if the Recurrence element is used. - /// the repeating times at which this profile - /// begins. This element is not used if the FixedDate element is - /// used. - public AutoscaleProfile(string name, ScaleCapacity capacity, IList rules, TimeWindow fixedDate = default(TimeWindow), Recurrence recurrence = default(Recurrence)) + + /// the name of the profile. + /// + + /// the number of instances that can be used during this profile. + /// + + /// the collection of rules that provide the triggers and parameters for the + /// scaling action. A maximum of 10 rules can be specified. + /// + + /// the specific date-time for the profile. This element is not used if the + /// Recurrence element is used. + /// + + /// the repeating times at which this profile begins. This element is not used + /// if the FixedDate element is used. + /// + public AutoscaleProfile(string name, ScaleCapacity capacity, System.Collections.Generic.IList rules, TimeWindow fixedDate = default(TimeWindow), Recurrence recurrence = default(Recurrence)) + { - Name = name; - Capacity = capacity; - Rules = rules; - FixedDate = fixedDate; - Recurrence = recurrence; + this.Name = name; + this.Capacity = capacity; + this.Rules = rules; + this.FixedDate = fixedDate; + this.Recurrence = recurrence; CustomInit(); } @@ -58,68 +57,67 @@ public AutoscaleProfile() /// partial void CustomInit(); + /// /// Gets or sets the name of the profile. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// - /// Gets or sets the number of instances that can be used during this - /// profile. + /// Gets or sets the number of instances that can be used during this profile. /// - [JsonProperty(PropertyName = "capacity")] - public ScaleCapacity Capacity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "capacity")] + public ScaleCapacity Capacity {get; set; } /// /// Gets or sets the collection of rules that provide the triggers and - /// parameters for the scaling action. A maximum of 10 rules can be - /// specified. + /// parameters for the scaling action. A maximum of 10 rules can be specified. /// - [JsonProperty(PropertyName = "rules")] - public IList Rules { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "rules")] + public System.Collections.Generic.IList Rules {get; set; } /// - /// Gets or sets the specific date-time for the profile. This element - /// is not used if the Recurrence element is used. + /// Gets or sets the specific date-time for the profile. This element is not + /// used if the Recurrence element is used. /// - [JsonProperty(PropertyName = "fixedDate")] - public TimeWindow FixedDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "fixedDate")] + public TimeWindow FixedDate {get; set; } /// - /// Gets or sets the repeating times at which this profile begins. This - /// element is not used if the FixedDate element is used. + /// Gets or sets the repeating times at which this profile begins. This element + /// is not used if the FixedDate element is used. /// - [JsonProperty(PropertyName = "recurrence")] - public Recurrence Recurrence { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "recurrence")] + public Recurrence Recurrence {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (Capacity == null) + if (this.Capacity == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Capacity"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Capacity"); } - if (Rules == null) + if (this.Rules == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Rules"); } - if (Capacity != null) + + if (this.Capacity != null) { - Capacity.Validate(); + this.Capacity.Validate(); } - if (Rules != null) + if (this.Rules != null) { - foreach (var element in Rules) + foreach (var element in this.Rules) { if (element != null) { @@ -127,14 +125,14 @@ public virtual void Validate() } } } - if (FixedDate != null) + if (this.FixedDate != null) { - FixedDate.Validate(); + this.FixedDate.Validate(); } - if (Recurrence != null) + if (this.Recurrence != null) { - Recurrence.Validate(); + this.Recurrence.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSetting.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSetting.cs new file mode 100644 index 000000000000..48f383a67f36 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSetting.cs @@ -0,0 +1,139 @@ +// 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 System.Linq; + + /// + /// A setting that contains all of the configuration for the automatic scaling + /// of a resource. + /// + public partial class AutoscaleSetting + { + /// + /// Initializes a new instance of the AutoscaleSetting class. + /// + public AutoscaleSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoscaleSetting class. + /// + + /// the collection of automatic scaling profiles that specify different scaling + /// parameters for different time periods. A maximum of 20 profiles can be + /// specified. + /// + + /// the collection of notifications. + /// + + /// the enabled flag. Specifies whether automatic scaling is enabled for the + /// resource. The default value is 'true'. + /// + + /// the name of the autoscale setting. + /// + + /// the resource identifier of the resource that the autoscale setting should + /// be added to. + /// + + /// the location of the resource that the autoscale setting should be added to. + /// + public AutoscaleSetting(System.Collections.Generic.IList profiles, System.Collections.Generic.IList notifications = default(System.Collections.Generic.IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + + { + this.Profiles = profiles; + this.Notifications = notifications; + this.Enabled = enabled; + this.Name = name; + this.TargetResourceUri = targetResourceUri; + this.TargetResourceLocation = targetResourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the collection of automatic scaling profiles that specify + /// different scaling parameters for different time periods. A maximum of 20 + /// profiles can be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "profiles")] + public System.Collections.Generic.IList Profiles {get; set; } + + /// + /// Gets or sets the collection of notifications. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notifications")] + public System.Collections.Generic.IList Notifications {get; set; } + + /// + /// Gets or sets the enabled flag. Specifies whether automatic scaling is + /// enabled for the resource. The default value is 'true'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool? Enabled {get; set; } + + /// + /// Gets or sets the name of the autoscale setting. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the resource identifier of the resource that the autoscale + /// setting should be added to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceUri")] + public string TargetResourceUri {get; set; } + + /// + /// Gets or sets the location of the resource that the autoscale setting should + /// be added to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceLocation")] + public string TargetResourceLocation {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Profiles == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Profiles"); + } + if (this.Profiles != null) + { + if (this.Profiles.Count > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxItems, "Profiles", 20); + } + foreach (var element in this.Profiles) + { + if (element != null) + { + element.Validate(); + } + } + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs index d888e469a939..149e990a433c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The autoscale setting resource. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AutoscaleSettingResource : Resource { /// @@ -34,34 +24,53 @@ public AutoscaleSettingResource() /// /// Initializes a new instance of the AutoscaleSettingResource class. /// - /// Resource location - /// the collection of automatic scaling profiles - /// that specify different scaling parameters for different time - /// periods. A maximum of 20 profiles can be specified. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the collection of - /// notifications. - /// the enabled flag. Specifies whether automatic - /// scaling is enabled for the resource. The default value is - /// 'true'. - /// the name of the - /// autoscale setting. - /// the resource identifier of the - /// resource that the autoscale setting should be added to. - /// the location of the resource - /// that the autoscale setting should be added to. - public AutoscaleSettingResource(string location, IList profiles, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string autoscaleSettingResourceName = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) - : base(location, id, name, type, tags) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// Resource tags + /// + + /// the collection of automatic scaling profiles that specify different scaling + /// parameters for different time periods. A maximum of 20 profiles can be + /// specified. + /// + + /// the collection of notifications. + /// + + /// the enabled flag. Specifies whether automatic scaling is enabled for the + /// resource. The default value is 'true'. + /// + + /// the name of the autoscale setting. + /// + + /// the resource identifier of the resource that the autoscale setting should + /// be added to. + /// + + /// the location of the resource that the autoscale setting should be added to. + /// + public AutoscaleSettingResource(string location, System.Collections.Generic.IList profiles, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList notifications = default(System.Collections.Generic.IList), bool? enabled = default(bool?), string propertiesName = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + + : base(location, id, name, type, tags) { - Profiles = profiles; - Notifications = notifications; - Enabled = enabled; - AutoscaleSettingResourceName = autoscaleSettingResourceName; - TargetResourceUri = targetResourceUri; - TargetResourceLocation = targetResourceLocation; + this.Profiles = profiles; + this.Notifications = notifications; + this.Enabled = enabled; + this.PropertiesName = propertiesName; + this.TargetResourceUri = targetResourceUri; + this.TargetResourceLocation = targetResourceLocation; CustomInit(); } @@ -70,67 +79,67 @@ public AutoscaleSettingResource() /// partial void CustomInit(); + /// - /// Gets or sets the collection of automatic scaling profiles that - /// specify different scaling parameters for different time periods. A - /// maximum of 20 profiles can be specified. + /// Gets or sets the collection of automatic scaling profiles that specify + /// different scaling parameters for different time periods. A maximum of 20 + /// profiles can be specified. /// - [JsonProperty(PropertyName = "properties.profiles")] - public IList Profiles { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.profiles")] + public System.Collections.Generic.IList Profiles {get; set; } /// /// Gets or sets the collection of notifications. /// - [JsonProperty(PropertyName = "properties.notifications")] - public IList Notifications { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notifications")] + public System.Collections.Generic.IList Notifications {get; set; } /// - /// Gets or sets the enabled flag. Specifies whether automatic scaling - /// is enabled for the resource. The default value is 'true'. + /// Gets or sets the enabled flag. Specifies whether automatic scaling is + /// enabled for the resource. The default value is 'true'. /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled {get; set; } /// /// Gets or sets the name of the autoscale setting. /// - [JsonProperty(PropertyName = "properties.name")] - public string AutoscaleSettingResourceName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] + public string PropertiesName {get; set; } /// - /// Gets or sets the resource identifier of the resource that the - /// autoscale setting should be added to. + /// Gets or sets the resource identifier of the resource that the autoscale + /// setting should be added to. /// - [JsonProperty(PropertyName = "properties.targetResourceUri")] - public string TargetResourceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceUri")] + public string TargetResourceUri {get; set; } /// - /// Gets or sets the location of the resource that the autoscale - /// setting should be added to. + /// Gets or sets the location of the resource that the autoscale setting should + /// be added to. /// - [JsonProperty(PropertyName = "properties.targetResourceLocation")] - public string TargetResourceLocation { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceLocation")] + public string TargetResourceLocation {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (Profiles == null) + if (this.Profiles == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Profiles"); } - if (Profiles != null) + if (this.Profiles != null) { - if (Profiles.Count > 20) + if (this.Profiles.Count > 20) { - throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxItems, "Profiles", 20); } - foreach (var element in Profiles) + foreach (var element in this.Profiles) { if (element != null) { @@ -138,6 +147,10 @@ public override void Validate() } } } + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs index c23a95232d7f..92dde820dfcd 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AutoscaleSettingResourcePatch.cs @@ -1,31 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The autoscale setting object for patch operations. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AutoscaleSettingResourcePatch { /// - /// Initializes a new instance of the AutoscaleSettingResourcePatch - /// class. + /// Initializes a new instance of the AutoscaleSettingResourcePatch class. /// public AutoscaleSettingResourcePatch() { @@ -33,32 +22,43 @@ public AutoscaleSettingResourcePatch() } /// - /// Initializes a new instance of the AutoscaleSettingResourcePatch - /// class. + /// Initializes a new instance of the AutoscaleSettingResourcePatch class. /// - /// the collection of automatic scaling profiles - /// that specify different scaling parameters for different time - /// periods. A maximum of 20 profiles can be specified. - /// Resource tags - /// the collection of - /// notifications. - /// the enabled flag. Specifies whether automatic - /// scaling is enabled for the resource. The default value is - /// 'true'. - /// the name of the autoscale setting. - /// the resource identifier of the - /// resource that the autoscale setting should be added to. - /// the location of the resource - /// that the autoscale setting should be added to. - public AutoscaleSettingResourcePatch(IList profiles, IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + + /// Resource tags + /// + + /// the collection of automatic scaling profiles that specify different scaling + /// parameters for different time periods. A maximum of 20 profiles can be + /// specified. + /// + + /// the collection of notifications. + /// + + /// the enabled flag. Specifies whether automatic scaling is enabled for the + /// resource. The default value is 'true'. + /// + + /// the name of the autoscale setting. + /// + + /// the resource identifier of the resource that the autoscale setting should + /// be added to. + /// + + /// the location of the resource that the autoscale setting should be added to. + /// + public AutoscaleSettingResourcePatch(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList profiles = default(System.Collections.Generic.IList), System.Collections.Generic.IList notifications = default(System.Collections.Generic.IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string), string targetResourceLocation = default(string)) + { - Tags = tags; - Profiles = profiles; - Notifications = notifications; - Enabled = enabled; - Name = name; - TargetResourceUri = targetResourceUri; - TargetResourceLocation = targetResourceLocation; + this.Tags = tags; + this.Profiles = profiles; + this.Notifications = notifications; + this.Enabled = enabled; + this.Name = name; + this.TargetResourceUri = targetResourceUri; + this.TargetResourceLocation = targetResourceLocation; CustomInit(); } @@ -67,72 +67,69 @@ public AutoscaleSettingResourcePatch() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// - /// Gets or sets the collection of automatic scaling profiles that - /// specify different scaling parameters for different time periods. A - /// maximum of 20 profiles can be specified. + /// Gets or sets the collection of automatic scaling profiles that specify + /// different scaling parameters for different time periods. A maximum of 20 + /// profiles can be specified. /// - [JsonProperty(PropertyName = "properties.profiles")] - public IList Profiles { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.profiles")] + public System.Collections.Generic.IList Profiles {get; set; } /// /// Gets or sets the collection of notifications. /// - [JsonProperty(PropertyName = "properties.notifications")] - public IList Notifications { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notifications")] + public System.Collections.Generic.IList Notifications {get; set; } /// - /// Gets or sets the enabled flag. Specifies whether automatic scaling - /// is enabled for the resource. The default value is 'true'. + /// Gets or sets the enabled flag. Specifies whether automatic scaling is + /// enabled for the resource. The default value is 'true'. /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled {get; set; } /// /// Gets or sets the name of the autoscale setting. /// - [JsonProperty(PropertyName = "properties.name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] + public string Name {get; set; } /// - /// Gets or sets the resource identifier of the resource that the - /// autoscale setting should be added to. + /// Gets or sets the resource identifier of the resource that the autoscale + /// setting should be added to. /// - [JsonProperty(PropertyName = "properties.targetResourceUri")] - public string TargetResourceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceUri")] + public string TargetResourceUri {get; set; } /// - /// Gets or sets the location of the resource that the autoscale - /// setting should be added to. + /// Gets or sets the location of the resource that the autoscale setting should + /// be added to. /// - [JsonProperty(PropertyName = "properties.targetResourceLocation")] - public string TargetResourceLocation { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceLocation")] + public string TargetResourceLocation {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Profiles == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); - } - if (Profiles != null) + + if (this.Profiles != null) { - if (Profiles.Count > 20) + if (this.Profiles.Count > 20) { - throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxItems, "Profiles", 20); } - foreach (var element in Profiles) + foreach (var element in this.Profiles) { if (element != null) { @@ -140,6 +137,10 @@ public virtual void Validate() } } } + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs index 47dbcf85231d..3ed83ea0cfce 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScope.cs @@ -1,31 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AzureMonitorPrivateLinkScope : PrivateLinkScopesResource { /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. + /// Initializes a new instance of the AzureMonitorPrivateLinkScope class. /// public AzureMonitorPrivateLinkScope() { @@ -33,26 +22,38 @@ public AzureMonitorPrivateLinkScope() } /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. + /// 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) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// 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), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string provisioningState = default(string), System.Collections.Generic.IList privateEndpointConnections = default(System.Collections.Generic.IList)) + + : base(location, id, name, type, tags) { - ProvisioningState = provisioningState; - PrivateEndpointConnections = privateEndpointConnections; + this.ProvisioningState = provisioningState; + this.PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -61,33 +62,34 @@ public AzureMonitorPrivateLinkScope() /// 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. + /// 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; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (PrivateEndpointConnections != null) + + if (this.PrivateEndpointConnections != null) { - foreach (var element in PrivateEndpointConnections) + foreach (var element in this.PrivateEndpointConnections) { if (element != null) { @@ -97,4 +99,4 @@ public override void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScopeProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScopeProperties.cs new file mode 100644 index 000000000000..f05de3965344 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AzureMonitorPrivateLinkScopeProperties.cs @@ -0,0 +1,64 @@ +// 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 System.Linq; + + /// + /// Properties that define a Azure Monitor PrivateLinkScope resource. + /// + public partial class AzureMonitorPrivateLinkScopeProperties + { + /// + /// Initializes a new instance of the AzureMonitorPrivateLinkScopeProperties class. + /// + public AzureMonitorPrivateLinkScopeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureMonitorPrivateLinkScopeProperties class. + /// + + /// 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 AzureMonitorPrivateLinkScopeProperties(string provisioningState = default(string), System.Collections.Generic.IList privateEndpointConnections = default(System.Collections.Generic.IList)) + + { + this.ProvisioningState = provisioningState; + this.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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + + /// + /// Gets list of private endpoint connections. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateEndpointConnections")] + public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs index fa234fe8bac1..57a556042111 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineMetadata.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,12 +23,17 @@ public BaselineMetadata() /// /// Initializes a new instance of the BaselineMetadata class. /// - /// Name of the baseline metadata. - /// Value of the baseline metadata. + + /// Name of the baseline metadata. + /// + + /// Value of the baseline metadata. + /// public BaselineMetadata(string name, string value) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -44,34 +42,36 @@ public BaselineMetadata(string name, string value) /// partial void CustomInit(); + /// /// Gets or sets name of the baseline metadata. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets value of the baseline metadata. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (Value == null) + if (this.Value == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); } + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs index 4170b0895b20..24bc197f8fe9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/BaselineSensitivity.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for BaselineSensitivity. /// + + public static class BaselineSensitivity { public const string Low = "Low"; public const string Medium = "Medium"; public const string High = "High"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs index 7c4846aeb1f2..af1311b26025 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ComparisonOperationType.cs @@ -1,37 +1,30 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for ComparisonOperationType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ComparisonOperationType { - [EnumMember(Value = "Equals")] + [System.Runtime.Serialization.EnumMember(Value = "Equals")] Equals, - [EnumMember(Value = "NotEquals")] + [System.Runtime.Serialization.EnumMember(Value = "NotEquals")] NotEquals, - [EnumMember(Value = "GreaterThan")] + [System.Runtime.Serialization.EnumMember(Value = "GreaterThan")] GreaterThan, - [EnumMember(Value = "GreaterThanOrEqual")] + [System.Runtime.Serialization.EnumMember(Value = "GreaterThanOrEqual")] GreaterThanOrEqual, - [EnumMember(Value = "LessThan")] + [System.Runtime.Serialization.EnumMember(Value = "LessThan")] LessThan, - [EnumMember(Value = "LessThanOrEqual")] + [System.Runtime.Serialization.EnumMember(Value = "LessThanOrEqual")] LessThanOrEqual } internal static class ComparisonOperationTypeEnumExtension @@ -40,7 +33,6 @@ internal static string ToSerializedValue(this ComparisonOperationType? value) { return value == null ? null : ((ComparisonOperationType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this ComparisonOperationType value) { switch( value ) @@ -60,7 +52,6 @@ internal static string ToSerializedValue(this ComparisonOperationType value) } return null; } - internal static ComparisonOperationType? ParseComparisonOperationType(this string value) { switch( value ) @@ -81,4 +72,4 @@ internal static string ToSerializedValue(this ComparisonOperationType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs index 7b4003f6cb1d..722c53bf1082 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ConditionOperator.cs @@ -1,33 +1,26 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for ConditionOperator. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ConditionOperator { - [EnumMember(Value = "GreaterThan")] + [System.Runtime.Serialization.EnumMember(Value = "GreaterThan")] GreaterThan, - [EnumMember(Value = "GreaterThanOrEqual")] + [System.Runtime.Serialization.EnumMember(Value = "GreaterThanOrEqual")] GreaterThanOrEqual, - [EnumMember(Value = "LessThan")] + [System.Runtime.Serialization.EnumMember(Value = "LessThan")] LessThan, - [EnumMember(Value = "LessThanOrEqual")] + [System.Runtime.Serialization.EnumMember(Value = "LessThanOrEqual")] LessThanOrEqual } internal static class ConditionOperatorEnumExtension @@ -36,7 +29,6 @@ internal static string ToSerializedValue(this ConditionOperator? value) { return value == null ? null : ((ConditionOperator)value).ToSerializedValue(); } - internal static string ToSerializedValue(this ConditionOperator value) { switch( value ) @@ -52,7 +44,6 @@ internal static string ToSerializedValue(this ConditionOperator value) } return null; } - internal static ConditionOperator? ParseConditionOperator(this string value) { switch( value ) @@ -69,4 +60,4 @@ internal static string ToSerializedValue(this ConditionOperator value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/CriterionType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/CriterionType.cs new file mode 100644 index 000000000000..9a461b5e86d0 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/CriterionType.cs @@ -0,0 +1,19 @@ +// 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 CriterionType. + /// + + + public static class CriterionType + { + public const string StaticThresholdCriterion = "StaticThresholdCriterion"; + public const string DynamicThresholdCriterion = "DynamicThresholdCriterion"; + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettings.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettings.cs new file mode 100644 index 000000000000..2e7f19efadc8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettings.cs @@ -0,0 +1,135 @@ +// 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 System.Linq; + + /// + /// The diagnostic settings. + /// + public partial class DiagnosticSettings + { + /// + /// Initializes a new instance of the DiagnosticSettings class. + /// + public DiagnosticSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticSettings class. + /// + + /// The resource ID of the storage account to which you would like to send + /// Diagnostic Logs. + /// + + /// The service bus rule Id of the diagnostic setting. This is here to maintain + /// backwards compatibility. + /// + + /// The resource Id for the event hub authorization rule. + /// + + /// The name of the event hub. If none is specified, the default event hub will + /// be selected. + /// + + /// The list of metric settings. + /// + + /// The list of logs settings. + /// + + /// The full ARM resource ID of the Log Analytics workspace to which you would + /// like to send Diagnostic Logs. Example: + /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + /// + + /// A string indicating whether the export to Log Analytics should use the + /// default destination type, i.e. AzureDiagnostics, or use a destination type + /// constructed as follows: <normalized service identity>_<normalized category + /// name>. Possible values are: Dedicated and null (null is default.) + /// + public DiagnosticSettings(string storageAccountId = default(string), string serviceBusRuleId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), System.Collections.Generic.IList metrics = default(System.Collections.Generic.IList), System.Collections.Generic.IList logs = default(System.Collections.Generic.IList), string workspaceId = default(string), string logAnalyticsDestinationType = default(string)) + + { + this.StorageAccountId = storageAccountId; + this.ServiceBusRuleId = serviceBusRuleId; + this.EventHubAuthorizationRuleId = eventHubAuthorizationRuleId; + this.EventHubName = eventHubName; + this.Metrics = metrics; + this.Logs = logs; + this.WorkspaceId = workspaceId; + this.LogAnalyticsDestinationType = logAnalyticsDestinationType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the storage account to which you would like + /// to send Diagnostic Logs. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId {get; set; } + + /// + /// Gets or sets the service bus rule Id of the diagnostic setting. This is + /// here to maintain backwards compatibility. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "serviceBusRuleId")] + public string ServiceBusRuleId {get; set; } + + /// + /// Gets or sets the resource Id for the event hub authorization rule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventHubAuthorizationRuleId")] + public string EventHubAuthorizationRuleId {get; set; } + + /// + /// Gets or sets the name of the event hub. If none is specified, the default + /// event hub will be selected. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventHubName")] + public string EventHubName {get; set; } + + /// + /// Gets or sets the list of metric settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metrics")] + public System.Collections.Generic.IList Metrics {get; set; } + + /// + /// Gets or sets the list of logs settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "logs")] + public System.Collections.Generic.IList Logs {get; set; } + + /// + /// Gets or sets the full ARM resource ID of the Log Analytics workspace to + /// which you would like to send Diagnostic Logs. Example: + /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "workspaceId")] + public string WorkspaceId {get; set; } + + /// + /// Gets or sets a string indicating whether the export to Log Analytics should + /// use the default destination type, i.e. AzureDiagnostics, or use a + /// destination type constructed as follows: <normalized service + /// identity>_<normalized category name>. Possible values are: Dedicated and + /// null (null is default.) + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "logAnalyticsDestinationType")] + public string LogAnalyticsDestinationType {get; set; } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs index cacc1ef47e8e..2665249b27b9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The diagnostic setting resource. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class DiagnosticSettingsResource : ProxyOnlyResource { /// @@ -34,41 +24,59 @@ public DiagnosticSettingsResource() /// /// Initializes a new instance of the DiagnosticSettingsResource class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The resource ID of the storage - /// account to which you would like to send Diagnostic Logs. - /// The service bus rule Id of the - /// diagnostic setting. This is here to maintain backwards - /// compatibility. - /// The resource Id for the - /// event hub authorization rule. - /// The name of the event hub. If none is - /// specified, the default event hub will be selected. - /// The list of metric settings. - /// The list of logs settings. - /// The full ARM resource ID of the Log - /// Analytics workspace to which you would like to send Diagnostic - /// Logs. Example: - /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - /// A string indicating - /// whether the export to Log Analytics should use the default - /// destination type, i.e. AzureDiagnostics, or use a destination type - /// constructed as follows: <normalized service - /// identity>_<normalized category name>. Possible values are: - /// Dedicated and null (null is default.) - public DiagnosticSettingsResource(string id = default(string), string name = default(string), string type = default(string), string storageAccountId = default(string), string serviceBusRuleId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), IList metrics = default(IList), IList logs = default(IList), string workspaceId = default(string), string logAnalyticsDestinationType = default(string)) - : base(id, name, type) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// The resource ID of the storage account to which you would like to send + /// Diagnostic Logs. + /// + + /// The service bus rule Id of the diagnostic setting. This is here to maintain + /// backwards compatibility. + /// + + /// The resource Id for the event hub authorization rule. + /// + + /// The name of the event hub. If none is specified, the default event hub will + /// be selected. + /// + + /// The list of metric settings. + /// + + /// The list of logs settings. + /// + + /// The full ARM resource ID of the Log Analytics workspace to which you would + /// like to send Diagnostic Logs. Example: + /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + /// + + /// A string indicating whether the export to Log Analytics should use the + /// default destination type, i.e. AzureDiagnostics, or use a destination type + /// constructed as follows: <normalized service identity>_<normalized category + /// name>. Possible values are: Dedicated and null (null is default.) + /// + public DiagnosticSettingsResource(string id = default(string), string name = default(string), string type = default(string), string storageAccountId = default(string), string serviceBusRuleId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), System.Collections.Generic.IList metrics = default(System.Collections.Generic.IList), System.Collections.Generic.IList logs = default(System.Collections.Generic.IList), string workspaceId = default(string), string logAnalyticsDestinationType = default(string)) + + : base(id, name, type) { - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - EventHubAuthorizationRuleId = eventHubAuthorizationRuleId; - EventHubName = eventHubName; - Metrics = metrics; - Logs = logs; - WorkspaceId = workspaceId; - LogAnalyticsDestinationType = logAnalyticsDestinationType; + this.StorageAccountId = storageAccountId; + this.ServiceBusRuleId = serviceBusRuleId; + this.EventHubAuthorizationRuleId = eventHubAuthorizationRuleId; + this.EventHubName = eventHubName; + this.Metrics = metrics; + this.Logs = logs; + this.WorkspaceId = workspaceId; + this.LogAnalyticsDestinationType = logAnalyticsDestinationType; CustomInit(); } @@ -77,63 +85,62 @@ public DiagnosticSettingsResource() /// partial void CustomInit(); + /// - /// Gets or sets the resource ID of the storage account to which you - /// would like to send Diagnostic Logs. + /// Gets or sets the resource ID of the storage account to which you would like + /// to send Diagnostic Logs. /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId {get; set; } /// - /// Gets or sets the service bus rule Id of the diagnostic setting. - /// This is here to maintain backwards compatibility. + /// Gets or sets the service bus rule Id of the diagnostic setting. This is + /// here to maintain backwards compatibility. /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId {get; set; } /// /// Gets or sets the resource Id for the event hub authorization rule. /// - [JsonProperty(PropertyName = "properties.eventHubAuthorizationRuleId")] - public string EventHubAuthorizationRuleId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.eventHubAuthorizationRuleId")] + public string EventHubAuthorizationRuleId {get; set; } /// - /// Gets or sets the name of the event hub. If none is specified, the - /// default event hub will be selected. + /// Gets or sets the name of the event hub. If none is specified, the default + /// event hub will be selected. /// - [JsonProperty(PropertyName = "properties.eventHubName")] - public string EventHubName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.eventHubName")] + public string EventHubName {get; set; } /// /// Gets or sets the list of metric settings. /// - [JsonProperty(PropertyName = "properties.metrics")] - public IList Metrics { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.metrics")] + public System.Collections.Generic.IList Metrics {get; set; } /// /// Gets or sets the list of logs settings. /// - [JsonProperty(PropertyName = "properties.logs")] - public IList Logs { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.logs")] + public System.Collections.Generic.IList Logs {get; set; } /// - /// Gets or sets the full ARM resource ID of the Log Analytics - /// workspace to which you would like to send Diagnostic Logs. Example: + /// Gets or sets the full ARM resource ID of the Log Analytics workspace to + /// which you would like to send Diagnostic Logs. Example: /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 /// - [JsonProperty(PropertyName = "properties.workspaceId")] - public string WorkspaceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.workspaceId")] + public string WorkspaceId {get; set; } /// - /// Gets or sets a string indicating whether the export to Log - /// Analytics should use the default destination type, i.e. - /// AzureDiagnostics, or use a destination type constructed as follows: - /// &lt;normalized service identity&gt;_&lt;normalized - /// category name&gt;. Possible values are: Dedicated and null - /// (null is default.) + /// Gets or sets a string indicating whether the export to Log Analytics should + /// use the default destination type, i.e. AzureDiagnostics, or use a + /// destination type constructed as follows: <normalized service + /// identity>_<normalized category name>. Possible values are: Dedicated and + /// null (null is default.) /// - [JsonProperty(PropertyName = "properties.logAnalyticsDestinationType")] - public string LogAnalyticsDestinationType { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.logAnalyticsDestinationType")] + public string LogAnalyticsDestinationType {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs index 2ee813f37406..32a48c417bdb 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DiagnosticSettingsResourceCollection.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class DiagnosticSettingsResourceCollection { /// - /// Initializes a new instance of the - /// DiagnosticSettingsResourceCollection class. + /// Initializes a new instance of the DiagnosticSettingsResourceCollection class. /// public DiagnosticSettingsResourceCollection() { @@ -30,14 +21,15 @@ public DiagnosticSettingsResourceCollection() } /// - /// Initializes a new instance of the - /// DiagnosticSettingsResourceCollection class. + /// Initializes a new instance of the DiagnosticSettingsResourceCollection class. /// - /// The collection of diagnostic settings - /// resources;. - public DiagnosticSettingsResourceCollection(IList value = default(IList)) + + /// The collection of diagnostic settings resources;. + /// + public DiagnosticSettingsResourceCollection(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + { - Value = value; + this.Value = value; CustomInit(); } @@ -46,11 +38,11 @@ public DiagnosticSettingsResourceCollection() /// partial void CustomInit(); + /// /// Gets or sets the collection of diagnostic settings resources;. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs index 8dad3fa1d3f0..1324d2b809d6 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -33,38 +24,48 @@ public DynamicMetricCriteria() /// /// Initializes a new instance of the DynamicMetricCriteria class. /// - /// Name of the criteria. - /// Name of the metric. + + /// Name of the criteria. + /// + + /// Name of the metric. + /// + + /// Namespace of the metric. + /// + /// 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' - /// The extent of deviation required to - /// trigger an alert. This will affect how tight the threshold is to - /// the metric series pattern. Possible values include: 'Low', - /// 'Medium', 'High' - /// The minimum number of violations - /// required within the selected lookback time window required to raise - /// an alert. - /// Unmatched properties from the - /// message are deserialized this collection - /// Namespace of the metric. - /// List of dimension conditions. - /// Allows creating an alert rule on - /// a custom metric that isn't yet emitted, by causing the metric - /// validation to be skipped. - /// 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, 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) + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + + /// List of dimension conditions. + /// + + /// Allows creating an alert rule on a custom metric that isn't yet emitted, by + /// causing the metric validation to be skipped. + /// + + /// The operator used to compare the metric value against the threshold. + /// Possible values include: 'GreaterThan', 'LessThan', 'GreaterOrLessThan' + + /// The extent of deviation required to trigger an alert. This will affect how + /// tight the threshold is to the metric series pattern. + /// Possible values include: 'Low', 'Medium', 'High' + + /// The minimum number of violations required within the selected lookback time + /// window required to raise an alert. + /// + + /// 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, string timeAggregation, string operatorProperty, string alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?), System.DateTime? ignoreDataBefore = default(System.DateTime?)) + + : base(name, metricName, timeAggregation, metricNamespace, dimensions, skipMetricValidation) { - OperatorProperty = operatorProperty; - AlertSensitivity = alertSensitivity; - FailingPeriods = failingPeriods; - IgnoreDataBefore = ignoreDataBefore; + this.OperatorProperty = operatorProperty; + this.AlertSensitivity = alertSensitivity; + this.FailingPeriods = failingPeriods; + this.IgnoreDataBefore = ignoreDataBefore; CustomInit(); } @@ -73,62 +74,62 @@ public DynamicMetricCriteria() /// partial void CustomInit(); + /// - /// Gets or sets the operator used to compare the metric value against - /// the threshold. Possible values include: 'GreaterThan', 'LessThan', - /// 'GreaterOrLessThan' + /// Gets or sets the operator used to compare the metric value against the + /// threshold. Possible values include: 'GreaterThan', 'LessThan', 'GreaterOrLessThan' /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public string OperatorProperty {get; set; } /// - /// Gets or sets the extent of deviation required to trigger an alert. - /// This will affect how tight the threshold is to the metric series - /// pattern. Possible values include: 'Low', 'Medium', 'High' + /// Gets or sets the extent of deviation required to trigger an alert. This + /// will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' /// - [JsonProperty(PropertyName = "alertSensitivity")] - public string AlertSensitivity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "alertSensitivity")] + public string AlertSensitivity {get; set; } /// - /// Gets or sets the minimum number of violations required within the - /// selected lookback time window required to raise an alert. + /// Gets or sets the minimum number of violations required within the selected + /// lookback time window required to raise an alert. /// - [JsonProperty(PropertyName = "failingPeriods")] - public DynamicThresholdFailingPeriods FailingPeriods { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "failingPeriods")] + public DynamicThresholdFailingPeriods FailingPeriods {get; set; } /// - /// Gets or sets use this option to set the date from which to start - /// learning the metric historical data and calculate the dynamic - /// thresholds (in ISO8601 format) + /// Gets or sets use this option to set the date from which to start learning + /// the metric historical data and calculate the dynamic thresholds (in ISO8601 + /// format) /// - [JsonProperty(PropertyName = "ignoreDataBefore")] - public System.DateTime? IgnoreDataBefore { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "ignoreDataBefore")] + public System.DateTime? IgnoreDataBefore {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (OperatorProperty == null) + if (this.OperatorProperty == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OperatorProperty"); } - if (AlertSensitivity == null) + if (this.AlertSensitivity == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertSensitivity"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AlertSensitivity"); } - if (FailingPeriods == null) + if (this.FailingPeriods == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "FailingPeriods"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "FailingPeriods"); } - if (FailingPeriods != null) + + + if (this.FailingPeriods != null) { - FailingPeriods.Validate(); + this.FailingPeriods.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs index 013569f048c5..a52cf7f69182 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdFailingPeriods.cs @@ -1,27 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 minimum number of violations required within the selected lookback - /// time window required to raise an alert. + /// The minimum number of violations required within the selected lookback time + /// window required to raise an alert. /// public partial class DynamicThresholdFailingPeriods { /// - /// Initializes a new instance of the DynamicThresholdFailingPeriods - /// class. + /// Initializes a new instance of the DynamicThresholdFailingPeriods class. /// public DynamicThresholdFailingPeriods() { @@ -29,20 +22,22 @@ public DynamicThresholdFailingPeriods() } /// - /// Initializes a new instance of the DynamicThresholdFailingPeriods - /// class. + /// Initializes a new instance of the DynamicThresholdFailingPeriods class. /// - /// The number of aggregated - /// lookback points. The lookback time window is calculated based on - /// the aggregation granularity (windowSize) and the selected number of - /// aggregated points. - /// The number of violations to - /// trigger an alert. Should be smaller or equal to - /// numberOfEvaluationPeriods. + + /// The number of aggregated lookback points. The lookback time window is + /// calculated based on the aggregation granularity (windowSize) and the + /// selected number of aggregated points. + /// + + /// The number of violations to trigger an alert. Should be smaller or equal to + /// numberOfEvaluationPeriods. + /// public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double minFailingPeriodsToAlert) + { - NumberOfEvaluationPeriods = numberOfEvaluationPeriods; - MinFailingPeriodsToAlert = minFailingPeriodsToAlert; + this.NumberOfEvaluationPeriods = numberOfEvaluationPeriods; + this.MinFailingPeriodsToAlert = minFailingPeriodsToAlert; CustomInit(); } @@ -51,25 +46,25 @@ public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double m /// partial void CustomInit(); + /// - /// Gets or sets the number of aggregated lookback points. The lookback - /// time window is calculated based on the aggregation granularity - /// (windowSize) and the selected number of aggregated points. + /// Gets or sets the number of aggregated lookback points. The lookback time + /// window is calculated based on the aggregation granularity (windowSize) and + /// the selected number of aggregated points. /// - [JsonProperty(PropertyName = "numberOfEvaluationPeriods")] - public double NumberOfEvaluationPeriods { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "numberOfEvaluationPeriods")] + public double NumberOfEvaluationPeriods {get; set; } /// - /// Gets or sets the number of violations to trigger an alert. Should - /// be smaller or equal to numberOfEvaluationPeriods. + /// Gets or sets the number of violations to trigger an alert. Should be + /// smaller or equal to numberOfEvaluationPeriods. /// - [JsonProperty(PropertyName = "minFailingPeriodsToAlert")] - public double MinFailingPeriodsToAlert { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "minFailingPeriodsToAlert")] + public double MinFailingPeriodsToAlert {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() @@ -77,4 +72,4 @@ public virtual void Validate() //Nothing to validate } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs index a887196950ae..324d0f3a422c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdOperator.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for DynamicThresholdOperator. /// + + public static class DynamicThresholdOperator { public const string GreaterThan = "GreaterThan"; public const string LessThan = "LessThan"; public const string GreaterOrLessThan = "GreaterOrLessThan"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs index 1b8751ab78b3..b8f0fcab181e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicThresholdSensitivity.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for DynamicThresholdSensitivity. /// + + public static class DynamicThresholdSensitivity { public const string Low = "Low"; public const string Medium = "Medium"; public const string High = "High"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs index ba475ecb62f2..802268592bed 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EmailNotification.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,18 +23,22 @@ public EmailNotification() /// /// Initializes a new instance of the EmailNotification class. /// - /// a value indicating - /// whether to send email to subscription administrator. - /// a value indicating - /// whether to send email to subscription co-administrators. - /// the custom e-mails list. This value can - /// be null or empty, in which case this attribute will be - /// ignored. - public EmailNotification(bool? sendToSubscriptionAdministrator = default(bool?), bool? sendToSubscriptionCoAdministrators = default(bool?), IList customEmails = default(IList)) + + /// a value indicating whether to send email to subscription administrator. + /// + + /// a value indicating whether to send email to subscription co-administrators. + /// + + /// the custom e-mails list. This value can be null or empty, in which case + /// this attribute will be ignored. + /// + public EmailNotification(bool? sendToSubscriptionAdministrator = default(bool?), bool? sendToSubscriptionCoAdministrators = default(bool?), System.Collections.Generic.IList customEmails = default(System.Collections.Generic.IList)) + { - SendToSubscriptionAdministrator = sendToSubscriptionAdministrator; - SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; - CustomEmails = customEmails; + this.SendToSubscriptionAdministrator = sendToSubscriptionAdministrator; + this.SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; + this.CustomEmails = customEmails; CustomInit(); } @@ -51,26 +47,26 @@ public EmailNotification() /// partial void CustomInit(); + /// - /// Gets or sets a value indicating whether to send email to - /// subscription administrator. + /// Gets or sets a value indicating whether to send email to subscription + /// administrator. /// - [JsonProperty(PropertyName = "sendToSubscriptionAdministrator")] - public bool? SendToSubscriptionAdministrator { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sendToSubscriptionAdministrator")] + public bool? SendToSubscriptionAdministrator {get; set; } /// - /// Gets or sets a value indicating whether to send email to - /// subscription co-administrators. + /// Gets or sets a value indicating whether to send email to subscription + /// co-administrators. /// - [JsonProperty(PropertyName = "sendToSubscriptionCoAdministrators")] - public bool? SendToSubscriptionCoAdministrators { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sendToSubscriptionCoAdministrators")] + public bool? SendToSubscriptionCoAdministrators {get; set; } /// - /// Gets or sets the custom e-mails list. This value can be null or - /// empty, in which case this attribute will be ignored. + /// Gets or sets the custom e-mails list. This value can be null or empty, in + /// which case this attribute will be ignored. /// - [JsonProperty(PropertyName = "customEmails")] - public IList CustomEmails { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "customEmails")] + public System.Collections.Generic.IList CustomEmails {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs index 05bf1fbd6ec3..fd09295bcc9f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorAdditionalInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,12 +23,17 @@ public ErrorAdditionalInfo() /// /// Initializes a new instance of the ErrorAdditionalInfo class. /// - /// The additional info type. - /// The additional info. + + /// The additional info type. + /// + + /// The additional info. + /// public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { - Type = type; - Info = info; + this.Type = type; + this.Info = info; CustomInit(); } @@ -43,17 +42,17 @@ public ErrorAdditionalInfo() /// partial void CustomInit(); + /// /// Gets the additional info type. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// /// Gets the additional info. /// - [JsonProperty(PropertyName = "info")] - public object Info { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "info")] + public object Info {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs index 2f93fbb9e247..82d2b32adc99 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,13 +23,17 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Error code - /// Error message indicating why the operation - /// failed. + + /// Error code + /// + + /// Error message indicating why the operation failed. + /// public ErrorResponse(string code = default(string), string message = default(string)) + { - Code = code; - Message = message; + this.Code = code; + this.Message = message; CustomInit(); } @@ -44,17 +42,17 @@ public ErrorResponse() /// partial void CustomInit(); + /// /// Gets or sets error code /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets error message indicating why the operation failed. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs index 03e89dfa4cbc..8124ad789338 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommon.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,16 +23,24 @@ public ErrorResponseCommon() /// /// 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) + + /// 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), System.Collections.Generic.IList details = default(System.Collections.Generic.IList), System.Collections.Generic.IList additionalInfo = default(System.Collections.Generic.IList)) + + : base(code, message) { - Details = details; - AdditionalInfo = additionalInfo; + this.Details = details; + this.AdditionalInfo = additionalInfo; CustomInit(); } @@ -49,17 +49,17 @@ public ErrorResponseCommon() /// partial void CustomInit(); + /// /// Gets the error details. /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public System.Collections.Generic.IList Details {get; private set; } /// /// Gets the error additional info. /// - [JsonProperty(PropertyName = "additionalInfo")] - public IList AdditionalInfo { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "additionalInfo")] + public System.Collections.Generic.IList AdditionalInfo {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseCommonException.cs deleted file mode 100644 index f68f9794927a..000000000000 --- a/src/Monitor/Monitor.Management.Sdk/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/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs index ad8fecdf5136..5e4210373fd6 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ErrorResponseException.cs @@ -1,32 +1,25 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 ErrorResponse - /// information. + /// Exception thrown for an invalid response with ErrorResponse information. /// - public partial class ErrorResponseException : RestException + public partial class ErrorResponseException : Microsoft.Rest.RestException { /// /// Gets information about the associated HTTP request. /// - public HttpRequestMessageWrapper Request { get; set; } + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } /// /// Gets information about the associated HTTP response. /// - public HttpResponseMessageWrapper Response { get; set; } + public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; } /// /// Gets or sets the body object. @@ -41,7 +34,7 @@ public ErrorResponseException() } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorResponse class. /// /// The exception message. public ErrorResponseException(string message) @@ -50,7 +43,7 @@ public ErrorResponseException(string message) } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorResponse class. /// /// The exception message. /// Inner exception. @@ -59,4 +52,4 @@ public ErrorResponseException(string message, System.Exception innerException) { } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs index 91dc9e9d304d..991d1ebbbce3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventData.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,94 +23,126 @@ public EventData() /// /// Initializes a new instance of the EventData class. /// - /// The sender authorization - /// information. - /// key value pairs to identify ARM - /// permissions. - /// the email address of the user who has - /// performed the operation, the UPN claim or SPN claim based on - /// availability. - /// the description of the event. - /// the Id of this event as required by ARM for RBAC. - /// It contains the EventDataID and a timestamp information. - /// the event data Id. This is a unique - /// identifier for an event. - /// the correlation Id, usually a GUID in - /// the string format. The correlation Id is shared among the events - /// that belong to the same uber operation. - /// the event name. This value should not be - /// confused with OperationName. For practical purposes, OperationName - /// might be more appealing to end users. - /// the event category. - /// the HTTP request info. Usually includes - /// the 'clientRequestId', 'clientIpAddress' (IP address of the user - /// who initiated the event) and 'method' (HTTP method e.g. - /// PUT). - /// the event level. Possible values include: - /// 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - /// the resource group name of the - /// impacted resource. - /// the resource provider name of - /// the impacted resource. - /// the resource uri that uniquely identifies - /// the resource that caused this event. - /// the resource type - /// It is usually a GUID shared among the - /// events corresponding to single operation. This value should not be - /// confused with EventName. - /// the operation name. - /// the set of <Key, Value> pairs - /// (usually a Dictionary<String, String>) that includes details - /// about the event. - /// a string describing the status of the - /// operation. Some typical values are: Started, In progress, - /// Succeeded, Failed, Resolved. - /// the event sub status. Most of the time, - /// when included, this captures the HTTP status code of the REST call. - /// Common values are: OK (HTTP Status Code: 200), Created (HTTP Status - /// Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP - /// Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found - /// (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal - /// Server Error (HTTP Status Code: 500), Service Unavailable (HTTP - /// Status Code:503), Gateway Timeout (HTTP Status Code: 504) - /// the timestamp of when the event was - /// generated by the Azure service processing the request corresponding - /// the event. It in ISO 8601 format. - /// the timestamp of when the event - /// became available for querying via this API. It is in ISO 8601 - /// format. This value should not be confused eventTimestamp. As there - /// might be a delay between the occurrence time of the event, and the - /// time that the event is submitted to the Azure logging - /// infrastructure. - /// the Azure subscription Id usually a - /// GUID. - /// the Azure tenant Id - public EventData(SenderAuthorization authorization = default(SenderAuthorization), IDictionary claims = default(IDictionary), string caller = default(string), string description = default(string), string id = default(string), string eventDataId = default(string), string correlationId = default(string), LocalizableString eventName = default(LocalizableString), LocalizableString category = default(LocalizableString), HttpRequestInfo httpRequest = default(HttpRequestInfo), EventLevel? level = default(EventLevel?), string resourceGroupName = default(string), LocalizableString resourceProviderName = default(LocalizableString), string resourceId = default(string), LocalizableString resourceType = default(LocalizableString), string operationId = default(string), LocalizableString operationName = default(LocalizableString), IDictionary properties = default(IDictionary), LocalizableString status = default(LocalizableString), LocalizableString subStatus = default(LocalizableString), System.DateTime? eventTimestamp = default(System.DateTime?), System.DateTime? submissionTimestamp = default(System.DateTime?), string subscriptionId = default(string), string tenantId = default(string)) + + /// The sender authorization information. + /// + + /// key value pairs to identify ARM permissions. + /// + + /// the email address of the user who has performed the operation, the UPN + /// claim or SPN claim based on availability. + /// + + /// the description of the event. + /// + + /// the Id of this event as required by ARM for RBAC. It contains the + /// EventDataID and a timestamp information. + /// + + /// the event data Id. This is a unique identifier for an event. + /// + + /// the correlation Id, usually a GUID in the string format. The correlation Id + /// is shared among the events that belong to the same uber operation. + /// + + /// the event name. This value should not be confused with OperationName. For + /// practical purposes, OperationName might be more appealing to end users. + /// + + /// the event category. + /// + + /// the HTTP request info. Usually includes the 'clientRequestId', + /// 'clientIpAddress' (IP address of the user who initiated the event) and + /// 'method' (HTTP method e.g. PUT). + /// + + /// the event level + /// Possible values include: 'Critical', 'Error', 'Warning', 'Informational', + /// 'Verbose' + + /// the resource group name of the impacted resource. + /// + + /// the resource provider name of the impacted resource. + /// + + /// the resource uri that uniquely identifies the resource that caused this + /// event. + /// + + /// the resource type + /// + + /// It is usually a GUID shared among the events corresponding to single + /// operation. This value should not be confused with EventName. + /// + + /// the operation name. + /// + + /// the set of <Key, Value> pairs (usually a Dictionary<String, String>) that + /// includes details about the event. + /// + + /// a string describing the status of the operation. Some typical values are: + /// Started, In progress, Succeeded, Failed, Resolved. + /// + + /// the event sub status. Most of the time, when included, this captures the + /// HTTP status code of the REST call. Common values are: OK (HTTP Status Code: + /// 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No + /// Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not + /// Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal + /// Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status + /// Code:503), Gateway Timeout (HTTP Status Code: 504) + /// + + /// the timestamp of when the event was generated by the Azure service + /// processing the request corresponding the event. It in ISO 8601 format. + /// + + /// the timestamp of when the event became available for querying via this API. + /// It is in ISO 8601 format. This value should not be confused eventTimestamp. + /// As there might be a delay between the occurrence time of the event, and the + /// time that the event is submitted to the Azure logging infrastructure. + /// + + /// the Azure subscription Id usually a GUID. + /// + + /// the Azure tenant Id + /// + public EventData(SenderAuthorization authorization = default(SenderAuthorization), System.Collections.Generic.IDictionary claims = default(System.Collections.Generic.IDictionary), string caller = default(string), string description = default(string), string id = default(string), string eventDataId = default(string), string correlationId = default(string), LocalizableString eventName = default(LocalizableString), LocalizableString category = default(LocalizableString), HttpRequestInfo httpRequest = default(HttpRequestInfo), EventLevel? level = default(EventLevel?), string resourceGroupName = default(string), LocalizableString resourceProviderName = default(LocalizableString), string resourceId = default(string), LocalizableString resourceType = default(LocalizableString), string operationId = default(string), LocalizableString operationName = default(LocalizableString), System.Collections.Generic.IDictionary properties = default(System.Collections.Generic.IDictionary), LocalizableString status = default(LocalizableString), LocalizableString subStatus = default(LocalizableString), System.DateTime? eventTimestamp = default(System.DateTime?), System.DateTime? submissionTimestamp = default(System.DateTime?), string subscriptionId = default(string), string tenantId = default(string)) + { - Authorization = authorization; - Claims = claims; - Caller = caller; - Description = description; - Id = id; - EventDataId = eventDataId; - CorrelationId = correlationId; - EventName = eventName; - Category = category; - HttpRequest = httpRequest; - Level = level; - ResourceGroupName = resourceGroupName; - ResourceProviderName = resourceProviderName; - ResourceId = resourceId; - ResourceType = resourceType; - OperationId = operationId; - OperationName = operationName; - Properties = properties; - Status = status; - SubStatus = subStatus; - EventTimestamp = eventTimestamp; - SubmissionTimestamp = submissionTimestamp; - SubscriptionId = subscriptionId; - TenantId = tenantId; + this.Authorization = authorization; + this.Claims = claims; + this.Caller = caller; + this.Description = description; + this.Id = id; + this.EventDataId = eventDataId; + this.CorrelationId = correlationId; + this.EventName = eventName; + this.Category = category; + this.HttpRequest = httpRequest; + this.Level = level; + this.ResourceGroupName = resourceGroupName; + this.ResourceProviderName = resourceProviderName; + this.ResourceId = resourceId; + this.ResourceType = resourceType; + this.OperationId = operationId; + this.OperationName = operationName; + this.Properties = properties; + this.Status = status; + this.SubStatus = subStatus; + this.EventTimestamp = eventTimestamp; + this.SubmissionTimestamp = submissionTimestamp; + this.SubscriptionId = subscriptionId; + this.TenantId = tenantId; CustomInit(); } @@ -127,213 +151,223 @@ public EventData() /// partial void CustomInit(); + /// /// Gets the sender authorization information. /// - [JsonProperty(PropertyName = "authorization")] - public SenderAuthorization Authorization { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "authorization")] + public SenderAuthorization Authorization {get; private set; } /// /// Gets key value pairs to identify ARM permissions. /// - [JsonProperty(PropertyName = "claims")] - public IDictionary Claims { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "claims")] + public System.Collections.Generic.IDictionary Claims {get; private set; } /// - /// Gets the email address of the user who has performed the operation, - /// the UPN claim or SPN claim based on availability. + /// Gets the email address of the user who has performed the operation, the UPN + /// claim or SPN claim based on availability. /// - [JsonProperty(PropertyName = "caller")] - public string Caller { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "caller")] + public string Caller {get; private set; } /// /// Gets the description of the event. /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } /// - /// Gets the Id of this event as required by ARM for RBAC. It contains - /// the EventDataID and a timestamp information. + /// Gets the Id of this event as required by ARM for RBAC. It contains the + /// EventDataID and a timestamp information. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets the event data Id. This is a unique identifier for an event. /// - [JsonProperty(PropertyName = "eventDataId")] - public string EventDataId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventDataId")] + public string EventDataId {get; private set; } /// /// Gets the correlation Id, usually a GUID in the string format. The - /// correlation Id is shared among the events that belong to the same - /// uber operation. + /// correlation Id is shared among the events that belong to the same uber + /// operation. /// - [JsonProperty(PropertyName = "correlationId")] - public string CorrelationId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "correlationId")] + public string CorrelationId {get; private set; } /// - /// Gets the event name. This value should not be confused with - /// OperationName. For practical purposes, OperationName might be more - /// appealing to end users. + /// Gets the event name. This value should not be confused with OperationName. + /// For practical purposes, OperationName might be more appealing to end users. /// - [JsonProperty(PropertyName = "eventName")] - public LocalizableString EventName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public LocalizableString EventName {get; private set; } /// /// Gets the event category. /// - [JsonProperty(PropertyName = "category")] - public LocalizableString Category { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public LocalizableString Category {get; private set; } /// - /// Gets the HTTP request info. Usually includes the 'clientRequestId', - /// 'clientIpAddress' (IP address of the user who initiated the event) - /// and 'method' (HTTP method e.g. PUT). + /// Gets the HTTP request info. Usually includes the 'clientRequestId', + /// 'clientIpAddress' (IP address of the user who initiated the event) and + /// 'method' (HTTP method e.g. PUT). /// - [JsonProperty(PropertyName = "httpRequest")] - public HttpRequestInfo HttpRequest { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "httpRequest")] + public HttpRequestInfo HttpRequest {get; private set; } /// - /// Gets the event level. Possible values include: 'Critical', 'Error', - /// 'Warning', 'Informational', 'Verbose' + /// Gets the event level Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' /// - [JsonProperty(PropertyName = "level")] - public EventLevel? Level { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "level")] + public EventLevel? Level {get; private set; } /// /// Gets the resource group name of the impacted resource. /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName {get; private set; } /// /// Gets the resource provider name of the impacted resource. /// - [JsonProperty(PropertyName = "resourceProviderName")] - public LocalizableString ResourceProviderName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceProviderName")] + public LocalizableString ResourceProviderName {get; private set; } /// - /// Gets the resource uri that uniquely identifies the resource that - /// caused this event. + /// Gets the resource uri that uniquely identifies the resource that caused + /// this event. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; private set; } /// /// Gets the resource type /// - [JsonProperty(PropertyName = "resourceType")] - public LocalizableString ResourceType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + public LocalizableString ResourceType {get; private set; } /// - /// Gets it is usually a GUID shared among the events corresponding to - /// single operation. This value should not be confused with EventName. + /// Gets it is usually a GUID shared among the events corresponding to single + /// operation. This value should not be confused with EventName. /// - [JsonProperty(PropertyName = "operationId")] - public string OperationId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operationId")] + public string OperationId {get; private set; } /// /// Gets the operation name. /// - [JsonProperty(PropertyName = "operationName")] - public LocalizableString OperationName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operationName")] + public LocalizableString OperationName {get; private set; } /// - /// Gets the set of &lt;Key, Value&gt; pairs (usually a - /// Dictionary&lt;String, String&gt;) that includes details - /// about the event. + /// Gets the set of <Key, Value> pairs (usually a Dictionary<String, String>) + /// that includes details about the event. /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public System.Collections.Generic.IDictionary Properties {get; private set; } /// - /// Gets a string describing the status of the operation. Some typical - /// values are: Started, In progress, Succeeded, Failed, Resolved. + /// Gets a string describing the status of the operation. Some typical values + /// are: Started, In progress, Succeeded, Failed, Resolved. /// - [JsonProperty(PropertyName = "status")] - public LocalizableString Status { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public LocalizableString Status {get; private set; } /// - /// Gets the event sub status. Most of the time, when included, this - /// captures the HTTP status code of the REST call. Common values are: - /// OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), - /// Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: - /// 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status - /// Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error - /// (HTTP Status Code: 500), Service Unavailable (HTTP Status - /// Code:503), Gateway Timeout (HTTP Status Code: 504) + /// Gets the event sub status. Most of the time, when included, this captures + /// the HTTP status code of the REST call. Common values are: OK (HTTP Status + /// Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: + /// 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: + /// 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), + /// Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP + /// Status Code:503), Gateway Timeout (HTTP Status Code: 504) /// - [JsonProperty(PropertyName = "subStatus")] - public LocalizableString SubStatus { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subStatus")] + public LocalizableString SubStatus {get; private set; } /// - /// Gets the timestamp of when the event was generated by the Azure - /// service processing the request corresponding the event. It in ISO - /// 8601 format. + /// Gets the timestamp of when the event was generated by the Azure service + /// processing the request corresponding the event. It in ISO 8601 format. /// - [JsonProperty(PropertyName = "eventTimestamp")] - public System.DateTime? EventTimestamp { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventTimestamp")] + public System.DateTime? EventTimestamp {get; private set; } /// - /// Gets the timestamp of when the event became available for querying - /// via this API. It is in ISO 8601 format. This value should not be - /// confused eventTimestamp. As there might be a delay between the - /// occurrence time of the event, and the time that the event is - /// submitted to the Azure logging infrastructure. + /// Gets the timestamp of when the event became available for querying via this + /// API. It is in ISO 8601 format. This value should not be confused + /// eventTimestamp. As there might be a delay between the occurrence time of + /// the event, and the time that the event is submitted to the Azure logging + /// infrastructure. /// - [JsonProperty(PropertyName = "submissionTimestamp")] - public System.DateTime? SubmissionTimestamp { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "submissionTimestamp")] + public System.DateTime? SubmissionTimestamp {get; private set; } /// /// Gets the Azure subscription Id usually a GUID. /// - [JsonProperty(PropertyName = "subscriptionId")] - public string SubscriptionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; private set; } /// /// Gets the Azure tenant Id /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (EventName != null) + + + + + + + + if (this.EventName != null) { - EventName.Validate(); + this.EventName.Validate(); } - if (Category != null) + if (this.Category != null) { - Category.Validate(); + this.Category.Validate(); } - if (ResourceProviderName != null) + + + + if (this.ResourceProviderName != null) { - ResourceProviderName.Validate(); + this.ResourceProviderName.Validate(); } - if (ResourceType != null) + + if (this.ResourceType != null) { - ResourceType.Validate(); + this.ResourceType.Validate(); } - if (OperationName != null) + + if (this.OperationName != null) { - OperationName.Validate(); + this.OperationName.Validate(); } - if (Status != null) + + if (this.Status != null) { - Status.Validate(); + this.Status.Validate(); } - if (SubStatus != null) + if (this.SubStatus != null) { - SubStatus.Validate(); + this.SubStatus.Validate(); } + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs index ac449a2bab87..761390a9739f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/EventLevel.cs @@ -1,35 +1,28 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for EventLevel. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum EventLevel { - [EnumMember(Value = "Critical")] + [System.Runtime.Serialization.EnumMember(Value = "Critical")] Critical, - [EnumMember(Value = "Error")] + [System.Runtime.Serialization.EnumMember(Value = "Error")] Error, - [EnumMember(Value = "Warning")] + [System.Runtime.Serialization.EnumMember(Value = "Warning")] Warning, - [EnumMember(Value = "Informational")] + [System.Runtime.Serialization.EnumMember(Value = "Informational")] Informational, - [EnumMember(Value = "Verbose")] + [System.Runtime.Serialization.EnumMember(Value = "Verbose")] Verbose } internal static class EventLevelEnumExtension @@ -38,7 +31,6 @@ internal static string ToSerializedValue(this EventLevel? value) { return value == null ? null : ((EventLevel)value).ToSerializedValue(); } - internal static string ToSerializedValue(this EventLevel value) { switch( value ) @@ -56,7 +48,6 @@ internal static string ToSerializedValue(this EventLevel value) } return null; } - internal static EventLevel? ParseEventLevel(this string value) { switch( value ) @@ -75,4 +66,4 @@ internal static string ToSerializedValue(this EventLevel value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs index 142ff887d3f5..c3cd48ee0158 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/HttpRequestInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,16 +23,25 @@ public HttpRequestInfo() /// /// Initializes a new instance of the HttpRequestInfo class. /// - /// the client request id. - /// the client Ip Address - /// the Http request method. - /// the Uri. - public HttpRequestInfo(string clientRequestId = default(string), string clientIpAddress = default(string), string method = default(string), string uri = default(string)) + + /// the client request id. + /// + + /// the client Ip Address + /// + + /// the Http request method. + /// + + /// the Uri. + /// + public HttpRequestInfo(string clientRequestId = default(string), string clientIPAddress = default(string), string method = default(string), string uri = default(string)) + { - ClientRequestId = clientRequestId; - ClientIpAddress = clientIpAddress; - Method = method; - Uri = uri; + this.ClientRequestId = clientRequestId; + this.ClientIpAddress = clientIPAddress; + this.Method = method; + this.Uri = uri; CustomInit(); } @@ -47,29 +50,29 @@ public HttpRequestInfo() /// partial void CustomInit(); + /// /// Gets or sets the client request id. /// - [JsonProperty(PropertyName = "clientRequestId")] - public string ClientRequestId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "clientRequestId")] + public string ClientRequestId {get; set; } /// /// Gets or sets the client Ip Address /// - [JsonProperty(PropertyName = "clientIpAddress")] - public string ClientIpAddress { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "clientIpAddress")] + public string ClientIpAddress {get; set; } /// /// Gets or sets the Http request method. /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "method")] + public string Method {get; set; } /// /// Gets or sets the Uri. /// - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + public string Uri {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs index 6db03f4d1e61..30c5695190f2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocalizableString.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,12 +23,17 @@ public LocalizableString() /// /// Initializes a new instance of the LocalizableString class. /// - /// the invariant value. - /// the locale specific value. + + /// the invariant value. + /// + + /// the locale specific value. + /// public LocalizableString(string value, string localizedValue = default(string)) + { - Value = value; - LocalizedValue = localizedValue; + this.Value = value; + this.LocalizedValue = localizedValue; CustomInit(); } @@ -44,30 +42,32 @@ public LocalizableString() /// partial void CustomInit(); + /// /// Gets or sets the invariant value. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } /// /// Gets or sets the locale specific value. /// - [JsonProperty(PropertyName = "localizedValue")] - public string LocalizedValue { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Value == null) + if (this.Value == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); } + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs index d8cfb0db1d24..33c3810c411b 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LocationThresholdRuleCondition.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -21,8 +14,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class LocationThresholdRuleCondition : RuleCondition { /// - /// Initializes a new instance of the LocationThresholdRuleCondition - /// class. + /// Initializes a new instance of the LocationThresholdRuleCondition class. /// public LocationThresholdRuleCondition() { @@ -30,23 +22,26 @@ public LocationThresholdRuleCondition() } /// - /// Initializes a new instance of the LocationThresholdRuleCondition - /// class. + /// Initializes a new instance of the LocationThresholdRuleCondition class. /// - /// the number of locations that must - /// fail to activate the alert. - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. + + /// the resource from which the rule collects its data. For this type + /// dataSource will always be of type RuleMetricDataSource. + /// + + /// the period of time (in ISO 8601 duration format) that is used to monitor + /// alert activity based on the threshold. If specified then it must be between + /// 5 minutes and 1 day. + /// + + /// the number of locations that must fail to activate the alert. + /// public LocationThresholdRuleCondition(int failedLocationCount, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?)) - : base(dataSource) + + : base(dataSource) { - WindowSize = windowSize; - FailedLocationCount = failedLocationCount; + this.WindowSize = windowSize; + this.FailedLocationCount = failedLocationCount; CustomInit(); } @@ -55,33 +50,32 @@ public LocationThresholdRuleCondition() /// partial void CustomInit(); + /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. If - /// specified then it must be between 5 minutes and 1 day. + /// Gets or sets the period of time (in ISO 8601 duration format) that is used + /// to monitor alert activity based on the threshold. If specified then it must + /// be between 5 minutes and 1 day. /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize {get; set; } /// - /// Gets or sets the number of locations that must fail to activate the - /// alert. + /// Gets or sets the number of locations that must fail to activate the alert. /// - [JsonProperty(PropertyName = "failedLocationCount")] - public int FailedLocationCount { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "failedLocationCount")] + public int FailedLocationCount {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (FailedLocationCount < 0) + if (this.FailedLocationCount < 0) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "FailedLocationCount", 0); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "FailedLocationCount", 0); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileProperties.cs new file mode 100644 index 000000000000..5b528da687da --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileProperties.cs @@ -0,0 +1,132 @@ +// 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 System.Linq; + + /// + /// The log profile properties. + /// + public partial class LogProfileProperties + { + /// + /// Initializes a new instance of the LogProfileProperties class. + /// + public LogProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogProfileProperties class. + /// + + /// the resource id of the storage account to which you would like to send the + /// Activity Log. + /// + + /// The service bus rule ID of the service bus namespace in which you would + /// like to have Event Hubs created for streaming the Activity Log. The rule ID + /// is of the format: '{service bus resource ID}/authorizationrules/{key + /// name}'. + /// + + /// List of regions for which Activity Log events should be stored or streamed. + /// It is a comma separated list of valid ARM locations including the 'global' + /// location. + /// + + /// the categories of the logs. These categories are created as is convenient + /// to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + /// + + /// the retention policy for the events in the log. + /// + public LogProfileProperties(System.Collections.Generic.IList locations, System.Collections.Generic.IList categories, RetentionPolicy retentionPolicy, string storageAccountId = default(string), string serviceBusRuleId = default(string)) + + { + this.StorageAccountId = storageAccountId; + this.ServiceBusRuleId = serviceBusRuleId; + this.Locations = locations; + this.Categories = categories; + this.RetentionPolicy = retentionPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource id of the storage account to which you would like + /// to send the Activity Log. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId {get; set; } + + /// + /// Gets or sets the service bus rule ID of the service bus namespace in which + /// you would like to have Event Hubs created for streaming the Activity Log. + /// The rule ID is of the format: '{service bus resource + /// ID}/authorizationrules/{key name}'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "serviceBusRuleId")] + public string ServiceBusRuleId {get; set; } + + /// + /// Gets or sets list of regions for which Activity Log events should be stored + /// or streamed. It is a comma separated list of valid ARM locations including + /// the 'global' location. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "locations")] + public System.Collections.Generic.IList Locations {get; set; } + + /// + /// Gets or sets the categories of the logs. These categories are created as is + /// convenient to the user. Some values are: 'Write', 'Delete', and/or + /// 'Action.' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "categories")] + public System.Collections.Generic.IList Categories {get; set; } + + /// + /// Gets or sets the retention policy for the events in the log. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "retentionPolicy")] + public RetentionPolicy RetentionPolicy {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Locations == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Locations"); + } + if (this.Categories == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Categories"); + } + if (this.RetentionPolicy == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RetentionPolicy"); + } + + + + + if (this.RetentionPolicy != null) + { + this.RetentionPolicy.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs index a709d9399b93..ac31db4de798 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The log profile resource. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LogProfileResource : Resource { /// @@ -34,34 +24,52 @@ public LogProfileResource() /// /// Initializes a new instance of the LogProfileResource class. /// - /// Resource location - /// List of regions for which Activity Log - /// events should be stored or streamed. It is a comma separated list - /// of valid ARM locations including the 'global' location. - /// the categories of the logs. These - /// categories are created as is convenient to the user. Some values - /// are: 'Write', 'Delete', and/or 'Action.' - /// the retention policy for the events - /// in the log. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the resource id of the storage - /// account to which you would like to send the Activity Log. - /// The service bus rule ID of the - /// service bus namespace in which you would like to have Event Hubs - /// created for streaming the Activity Log. The rule ID is of the - /// format: '{service bus resource ID}/authorizationrules/{key - /// name}'. - public LogProfileResource(string location, IList locations, IList categories, RetentionPolicy retentionPolicy, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) - : base(location, id, name, type, tags) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// Resource tags + /// + + /// the retention policy for the events in the log. + /// + + /// the resource id of the storage account to which you would like to send the + /// Activity Log. + /// + + /// The service bus rule ID of the service bus namespace in which you would + /// like to have Event Hubs created for streaming the Activity Log. The rule ID + /// is of the format: '{service bus resource ID}/authorizationrules/{key + /// name}'. + /// + + /// List of regions for which Activity Log events should be stored or streamed. + /// It is a comma separated list of valid ARM locations including the 'global' + /// location. + /// + + /// the categories of the logs. These categories are created as is convenient + /// to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + /// + public LogProfileResource(string location, RetentionPolicy retentionPolicy, System.Collections.Generic.IList locations, System.Collections.Generic.IList categories, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) + + : base(location, id, name, type, tags) { - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - Locations = locations; - Categories = categories; - RetentionPolicy = retentionPolicy; + this.RetentionPolicy = retentionPolicy; + this.StorageAccountId = storageAccountId; + this.ServiceBusRuleId = serviceBusRuleId; + this.Locations = locations; + this.Categories = categories; CustomInit(); } @@ -70,69 +78,73 @@ public LogProfileResource() /// partial void CustomInit(); + /// - /// Gets or sets the resource id of the storage account to which you - /// would like to send the Activity Log. + /// Gets or sets the retention policy for the events in the log. /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.retentionPolicy")] + public RetentionPolicy RetentionPolicy {get; set; } /// - /// Gets or sets the service bus rule ID of the service bus namespace - /// in which you would like to have Event Hubs created for streaming - /// the Activity Log. The rule ID is of the format: '{service bus - /// resource ID}/authorizationrules/{key name}'. + /// Gets or sets the resource id of the storage account to which you would like + /// to send the Activity Log. /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId {get; set; } /// - /// Gets or sets list of regions for which Activity Log events should - /// be stored or streamed. It is a comma separated list of valid ARM - /// locations including the 'global' location. + /// Gets or sets the service bus rule ID of the service bus namespace in which + /// you would like to have Event Hubs created for streaming the Activity Log. + /// The rule ID is of the format: '{service bus resource + /// ID}/authorizationrules/{key name}'. /// - [JsonProperty(PropertyName = "properties.locations")] - public IList Locations { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId {get; set; } /// - /// Gets or sets the categories of the logs. These categories are - /// created as is convenient to the user. Some values are: 'Write', - /// 'Delete', and/or 'Action.' + /// Gets or sets list of regions for which Activity Log events should be stored + /// or streamed. It is a comma separated list of valid ARM locations including + /// the 'global' location. /// - [JsonProperty(PropertyName = "properties.categories")] - public IList Categories { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.locations")] + public System.Collections.Generic.IList Locations {get; set; } /// - /// Gets or sets the retention policy for the events in the log. + /// Gets or sets the categories of the logs. These categories are created as is + /// convenient to the user. Some values are: 'Write', 'Delete', and/or + /// 'Action.' /// - [JsonProperty(PropertyName = "properties.retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.categories")] + public System.Collections.Generic.IList Categories {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (Locations == null) + if (this.RetentionPolicy == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RetentionPolicy"); } - if (Categories == null) + if (this.Locations == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Locations"); } - if (RetentionPolicy == null) + if (this.Categories == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Categories"); } - if (RetentionPolicy != null) + if (this.RetentionPolicy != null) { - RetentionPolicy.Validate(); + this.RetentionPolicy.Validate(); } + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs index a3622df0b0ea..9bc2b363ddff 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogProfileResourcePatch.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The log profile resource for patch operations. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class LogProfileResourcePatch { /// @@ -34,30 +24,40 @@ public LogProfileResourcePatch() /// /// Initializes a new instance of the LogProfileResourcePatch class. /// - /// List of regions for which Activity Log - /// events should be stored or streamed. It is a comma separated list - /// of valid ARM locations including the 'global' location. - /// the categories of the logs. These - /// categories are created as is convenient to the user. Some values - /// are: 'Write', 'Delete', and/or 'Action.' - /// the retention policy for the events - /// in the log. - /// Resource tags - /// the resource id of the storage - /// account to which you would like to send the Activity Log. - /// The service bus rule ID of the - /// service bus namespace in which you would like to have Event Hubs - /// created for streaming the Activity Log. The rule ID is of the - /// format: '{service bus resource ID}/authorizationrules/{key - /// name}'. - public LogProfileResourcePatch(IList locations, IList categories, RetentionPolicy retentionPolicy, IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) + + /// Resource tags + /// + + /// the retention policy for the events in the log. + /// + + /// the resource id of the storage account to which you would like to send the + /// Activity Log. + /// + + /// The service bus rule ID of the service bus namespace in which you would + /// like to have Event Hubs created for streaming the Activity Log. The rule ID + /// is of the format: '{service bus resource ID}/authorizationrules/{key + /// name}'. + /// + + /// List of regions for which Activity Log events should be stored or streamed. + /// It is a comma separated list of valid ARM locations including the 'global' + /// location. + /// + + /// the categories of the logs. These categories are created as is convenient + /// to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + /// + public LogProfileResourcePatch(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), RetentionPolicy retentionPolicy = default(RetentionPolicy), string storageAccountId = default(string), string serviceBusRuleId = default(string), System.Collections.Generic.IList locations = default(System.Collections.Generic.IList), System.Collections.Generic.IList categories = default(System.Collections.Generic.IList)) + { - Tags = tags; - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - Locations = locations; - Categories = categories; - RetentionPolicy = retentionPolicy; + this.Tags = tags; + this.RetentionPolicy = retentionPolicy; + this.StorageAccountId = storageAccountId; + this.ServiceBusRuleId = serviceBusRuleId; + this.Locations = locations; + this.Categories = categories; CustomInit(); } @@ -66,74 +66,67 @@ public LogProfileResourcePatch() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// - /// Gets or sets the resource id of the storage account to which you - /// would like to send the Activity Log. + /// Gets or sets the retention policy for the events in the log. /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.retentionPolicy")] + public RetentionPolicy RetentionPolicy {get; set; } /// - /// Gets or sets the service bus rule ID of the service bus namespace - /// in which you would like to have Event Hubs created for streaming - /// the Activity Log. The rule ID is of the format: '{service bus - /// resource ID}/authorizationrules/{key name}'. + /// Gets or sets the resource id of the storage account to which you would like + /// to send the Activity Log. /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageAccountId")] + public string StorageAccountId {get; set; } /// - /// Gets or sets list of regions for which Activity Log events should - /// be stored or streamed. It is a comma separated list of valid ARM - /// locations including the 'global' location. + /// Gets or sets the service bus rule ID of the service bus namespace in which + /// you would like to have Event Hubs created for streaming the Activity Log. + /// The rule ID is of the format: '{service bus resource + /// ID}/authorizationrules/{key name}'. /// - [JsonProperty(PropertyName = "properties.locations")] - public IList Locations { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.serviceBusRuleId")] + public string ServiceBusRuleId {get; set; } /// - /// Gets or sets the categories of the logs. These categories are - /// created as is convenient to the user. Some values are: 'Write', - /// 'Delete', and/or 'Action.' + /// Gets or sets list of regions for which Activity Log events should be stored + /// or streamed. It is a comma separated list of valid ARM locations including + /// the 'global' location. /// - [JsonProperty(PropertyName = "properties.categories")] - public IList Categories { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.locations")] + public System.Collections.Generic.IList Locations {get; set; } /// - /// Gets or sets the retention policy for the events in the log. + /// Gets or sets the categories of the logs. These categories are created as is + /// convenient to the user. Some values are: 'Write', 'Delete', and/or + /// 'Action.' /// - [JsonProperty(PropertyName = "properties.retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.categories")] + public System.Collections.Generic.IList Categories {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Locations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); - } - if (Categories == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); - } - if (RetentionPolicy == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); - } - if (RetentionPolicy != null) + + if (this.RetentionPolicy != null) { - RetentionPolicy.Validate(); + this.RetentionPolicy.Validate(); } + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs index fed0ef407cda..6f3c70ca4626 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/LogSettings.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,19 +24,23 @@ public LogSettings() /// /// Initializes a new instance of the LogSettings class. /// - /// a value indicating whether this log is - /// enabled. - /// Name of a Diagnostic Log category for a - /// resource type this setting is applied to. To obtain the list of - /// Diagnostic Log categories for a resource, first perform a GET - /// diagnostic settings operation. - /// the retention policy for this - /// log. + + /// Name of a Diagnostic Log category for a resource type this setting is + /// applied to. To obtain the list of Diagnostic Log categories for a resource, + /// first perform a GET diagnostic settings operation. + /// + + /// a value indicating whether this log is enabled. + /// + + /// the retention policy for this log. + /// public LogSettings(bool enabled, string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) + { - Category = category; - Enabled = enabled; - RetentionPolicy = retentionPolicy; + this.Category = category; + this.Enabled = enabled; + this.RetentionPolicy = retentionPolicy; CustomInit(); } @@ -51,39 +49,39 @@ public LogSettings() /// partial void CustomInit(); + /// - /// Gets or sets name of a Diagnostic Log category for a resource type - /// this setting is applied to. To obtain the list of Diagnostic Log - /// categories for a resource, first perform a GET diagnostic settings - /// operation. + /// Gets or sets name of a Diagnostic Log category for a resource type this + /// setting is applied to. To obtain the list of Diagnostic Log categories for + /// a resource, first perform a GET diagnostic settings operation. /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; set; } /// /// Gets or sets a value indicating whether this log is enabled. /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool Enabled {get; set; } /// /// Gets or sets the retention policy for this log. /// - [JsonProperty(PropertyName = "retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "retentionPolicy")] + public RetentionPolicy RetentionPolicy {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (RetentionPolicy != null) + + if (this.RetentionPolicy != null) { - RetentionPolicy.Validate(); + this.RetentionPolicy.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs index 0e2b2b3efa68..00dd333b5e3a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventAggregationCondition.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class ManagementEventAggregationCondition { /// - /// Initializes a new instance of the - /// ManagementEventAggregationCondition class. + /// Initializes a new instance of the ManagementEventAggregationCondition class. /// public ManagementEventAggregationCondition() { @@ -28,23 +21,26 @@ public ManagementEventAggregationCondition() } /// - /// Initializes a new instance of the - /// ManagementEventAggregationCondition class. + /// Initializes a new instance of the ManagementEventAggregationCondition class. /// - /// the condition operator. Possible - /// values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - /// 'LessThanOrEqual' - /// The threshold value that activates the - /// alert. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. + + /// the condition operator. + /// Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + /// 'LessThanOrEqual' + + /// The threshold value that activates the alert. + /// + + /// the period of time (in ISO 8601 duration format) that is used to monitor + /// alert activity based on the threshold. If specified then it must be between + /// 5 minutes and 1 day. + /// public ManagementEventAggregationCondition(ConditionOperator? operatorProperty = default(ConditionOperator?), double? threshold = default(double?), System.TimeSpan? windowSize = default(System.TimeSpan?)) + { - OperatorProperty = operatorProperty; - Threshold = threshold; - WindowSize = windowSize; + this.OperatorProperty = operatorProperty; + this.Threshold = threshold; + this.WindowSize = windowSize; CustomInit(); } @@ -53,26 +49,25 @@ public ManagementEventAggregationCondition() /// partial void CustomInit(); + /// - /// Gets or sets the condition operator. Possible values include: - /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// Gets or sets the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' /// - [JsonProperty(PropertyName = "operator")] - public ConditionOperator? OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public ConditionOperator? OperatorProperty {get; set; } /// /// Gets or sets the threshold value that activates the alert. /// - [JsonProperty(PropertyName = "threshold")] - public double? Threshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public double? Threshold {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. If - /// specified then it must be between 5 minutes and 1 day. + /// Gets or sets the period of time (in ISO 8601 duration format) that is used + /// to monitor alert activity based on the threshold. If specified then it must + /// be between 5 minutes and 1 day. /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs index 4ede5a411148..d42d2e653754 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ManagementEventRuleCondition.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -20,8 +14,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class ManagementEventRuleCondition : RuleCondition { /// - /// Initializes a new instance of the ManagementEventRuleCondition - /// class. + /// Initializes a new instance of the ManagementEventRuleCondition class. /// public ManagementEventRuleCondition() { @@ -29,20 +22,23 @@ public ManagementEventRuleCondition() } /// - /// Initializes a new instance of the ManagementEventRuleCondition - /// class. + /// Initializes a new instance of the ManagementEventRuleCondition class. /// - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// How the data that is collected should be - /// combined over time and when the alert is activated. Note that for - /// management event alerts aggregation is optional – if it is not - /// provided then any event will cause the alert to activate. + + /// the resource from which the rule collects its data. For this type + /// dataSource will always be of type RuleMetricDataSource. + /// + + /// How the data that is collected should be combined over time and when the + /// alert is activated. Note that for management event alerts aggregation is + /// optional – if it is not provided then any event will cause the alert to + /// activate. + /// public ManagementEventRuleCondition(RuleDataSource dataSource = default(RuleDataSource), ManagementEventAggregationCondition aggregation = default(ManagementEventAggregationCondition)) - : base(dataSource) + + : base(dataSource) { - Aggregation = aggregation; + this.Aggregation = aggregation; CustomInit(); } @@ -51,14 +47,14 @@ public ManagementEventRuleCondition() /// partial void CustomInit(); + /// - /// Gets or sets how the data that is collected should be combined over - /// time and when the alert is activated. Note that for management - /// event alerts aggregation is optional – if it is not provided then - /// any event will cause the alert to activate. + /// Gets or sets how the data that is collected should be combined over time + /// and when the alert is activated. Note that for management event alerts + /// aggregation is optional – if it is not provided then any event will cause + /// the alert to activate. /// - [JsonProperty(PropertyName = "aggregation")] - public ManagementEventAggregationCondition Aggregation { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "aggregation")] + public ManagementEventAggregationCondition Aggregation {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs index 84b70cfdc04d..aa09b0964a6e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetadataValue.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,12 +23,17 @@ public MetadataValue() /// /// Initializes a new instance of the MetadataValue class. /// - /// the name of the metadata. - /// the value of the metadata. + + /// the name of the metadata. + /// + + /// the value of the metadata. + /// public MetadataValue(LocalizableString name = default(LocalizableString), string value = default(string)) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -43,30 +42,31 @@ public MetadataValue() /// partial void CustomInit(); + /// /// Gets or sets the name of the metadata. /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public LocalizableString Name {get; set; } /// /// Gets or sets the value of the metadata. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name != null) + if (this.Name != null) { - Name.Validate(); + this.Name.Validate(); } + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs index 003ddb21c4c0..07d5beceb0c9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Metric.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,33 +23,43 @@ public Metric() /// /// Initializes a new instance of the Metric class. /// - /// the metric Id. - /// the resource type of the metric - /// resource. - /// the name and the display name of the metric, - /// i.e. it is localizable string. - /// The unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// the time series returned when a data query - /// is performed. - /// Detailed description of this - /// metric. - /// 'Success' or the error details on query - /// failures for this metric. - /// Error message encountered querying this - /// specific metric. - public Metric(string id, string type, LocalizableString name, string unit, IList timeseries, string displayDescription = default(string), string errorCode = default(string), string errorMessage = default(string)) + + /// the metric Id. + /// + + /// the resource type of the metric resource. + /// + + /// the name and the display name of the metric, i.e. it is localizable string. + /// + + /// Detailed description of this metric. + /// + + /// 'Success' or the error details on query failures for this metric. + /// + + /// Error message encountered querying this specific metric. + /// + + /// The unit of the metric. + /// Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', + /// 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', + /// 'Cores', 'MilliCores', 'NanoCores', 'BitsPerSecond' + + /// the time series returned when a data query is performed. + /// + public Metric(string id, string type, LocalizableString name, string unit, System.Collections.Generic.IList timeseries, string displayDescription = default(string), string errorCode = default(string), string errorMessage = default(string)) + { - Id = id; - Type = type; - Name = name; - DisplayDescription = displayDescription; - ErrorCode = errorCode; - ErrorMessage = errorMessage; - Unit = unit; - Timeseries = timeseries; + this.Id = id; + this.Type = type; + this.Name = name; + this.DisplayDescription = displayDescription; + this.ErrorCode = errorCode; + this.ErrorMessage = errorMessage; + this.Unit = unit; + this.Timeseries = timeseries; CustomInit(); } @@ -67,93 +68,95 @@ public Metric() /// partial void CustomInit(); + /// /// Gets or sets the metric Id. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// /// Gets or sets the resource type of the metric resource. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } /// - /// Gets or sets the name and the display name of the metric, i.e. it - /// is localizable string. + /// Gets or sets the name and the display name of the metric, i.e. it is + /// localizable string. /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public LocalizableString Name {get; set; } /// /// Gets or sets detailed description of this metric. /// - [JsonProperty(PropertyName = "displayDescription")] - public string DisplayDescription { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription {get; set; } /// - /// Gets or sets 'Success' or the error details on query failures for - /// this metric. + /// Gets or sets 'Success' or the error details on query failures for this + /// metric. /// - [JsonProperty(PropertyName = "errorCode")] - public string ErrorCode { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "errorCode")] + public string ErrorCode {get; set; } /// - /// Gets or sets error message encountered querying this specific - /// metric. + /// Gets or sets error message encountered querying this specific metric. /// - [JsonProperty(PropertyName = "errorMessage")] - public string ErrorMessage { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage {get; set; } /// - /// Gets or sets the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// Gets or sets the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', 'MilliCores', 'NanoCores', 'BitsPerSecond' /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "unit")] + public string Unit {get; set; } /// - /// Gets or sets the time series returned when a data query is - /// performed. + /// Gets or sets the time series returned when a data query is performed. /// - [JsonProperty(PropertyName = "timeseries")] - public IList Timeseries { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "timeseries")] + public System.Collections.Generic.IList Timeseries {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Id == null) + if (this.Id == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); } - if (Type == null) + if (this.Type == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type"); } - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (Unit == null) + if (this.Unit == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Unit"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Unit"); } - if (Timeseries == null) + if (this.Timeseries == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Timeseries"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Timeseries"); } - if (Name != null) + + + if (this.Name != null) { - Name.Validate(); + this.Name.Validate(); } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs index 34d8307f5947..563ff38a4d9c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertAction.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,15 +23,18 @@ public MetricAlertAction() /// /// Initializes a new instance of the MetricAlertAction class. /// - /// the id of the action group to - /// use. - /// 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)) + + /// the id of the action group to use. + /// + + /// 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), System.Collections.Generic.IDictionary webHookProperties = default(System.Collections.Generic.IDictionary)) + { - ActionGroupId = actionGroupId; - WebHookProperties = webHookProperties; + this.ActionGroupId = actionGroupId; + this.WebHookProperties = webHookProperties; CustomInit(); } @@ -48,19 +43,18 @@ public MetricAlertAction() /// partial void CustomInit(); + /// /// Gets or sets the id of the action group to use. /// - [JsonProperty(PropertyName = "actionGroupId")] - public string ActionGroupId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "actionGroupId")] + public string ActionGroupId {get; set; } /// - /// Gets or sets this field allows specifying custom properties, which - /// would be appended to the alert payload sent as input to the - /// webhook. + /// 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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "webHookProperties")] + public System.Collections.Generic.IDictionary WebHookProperties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs index e5d00fa0cdee..8db4a8a5b93a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertCriteria.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,11 +24,13 @@ public MetricAlertCriteria() /// /// Initializes a new instance of the MetricAlertCriteria class. /// - /// Unmatched properties from the - /// message are deserialized this collection - public MetricAlertCriteria(IDictionary additionalProperties = default(IDictionary)) + + /// The rule criteria that defines the conditions of the alert rule. + /// + public MetricAlertCriteria(System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary)) + { - AdditionalProperties = additionalProperties; + this.AdditionalProperties = additionalProperties; CustomInit(); } @@ -45,12 +39,12 @@ public MetricAlertCriteria() /// partial void CustomInit(); + /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection + /// Gets or sets the rule criteria that defines the conditions of the alert + /// rule. /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs index 105d3f132ee8..5d88a9feddab 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs @@ -1,30 +1,21 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// - /// Specifies the metric alert criteria for multiple resource that has - /// multiple metric criteria. + /// Specifies the metric alert criteria for multiple resource that has multiple + /// metric criteria. /// [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")] public partial class MetricAlertMultipleResourceMultipleMetricCriteria : MetricAlertCriteria { /// - /// Initializes a new instance of the - /// MetricAlertMultipleResourceMultipleMetricCriteria class. + /// Initializes a new instance of the MetricAlertMultipleResourceMultipleMetricCriteria class. /// public MetricAlertMultipleResourceMultipleMetricCriteria() { @@ -32,17 +23,19 @@ public MetricAlertMultipleResourceMultipleMetricCriteria() } /// - /// Initializes a new instance of the - /// MetricAlertMultipleResourceMultipleMetricCriteria class. + /// Initializes a new instance of the MetricAlertMultipleResourceMultipleMetricCriteria class. /// - /// Unmatched properties from the - /// message are deserialized this collection - /// the list of multiple metric criteria for this - /// 'all of' operation. - public MetricAlertMultipleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) - : base(additionalProperties) + + /// The rule criteria that defines the conditions of the alert rule. + /// + + /// the list of multiple metric criteria for this 'all of' operation. + /// + public MetricAlertMultipleResourceMultipleMetricCriteria(System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allOf = default(System.Collections.Generic.IList)) + + : base(additionalProperties) { - AllOf = allOf; + this.AllOf = allOf; CustomInit(); } @@ -51,12 +44,12 @@ public MetricAlertMultipleResourceMultipleMetricCriteria() /// partial void CustomInit(); + /// - /// Gets or sets the list of multiple metric criteria for this 'all of' + /// Gets or sets the list of multiple metric criteria for this 'all of' /// operation. /// - [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allOf")] + public System.Collections.Generic.IList AllOf {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertProperties.cs new file mode 100644 index 000000000000..d6ac3e4e56c6 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertProperties.cs @@ -0,0 +1,209 @@ +// 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 System.Linq; + + /// + /// An alert rule. + /// + public partial class MetricAlertProperties + { + /// + /// Initializes a new instance of the MetricAlertProperties class. + /// + public MetricAlertProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertProperties class. + /// + + /// 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. + /// + + /// the resource type of the target 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 if the scope contains a subscription, resource group, or more + /// than one resource. + /// + + /// 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 the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + + /// the value indicating whether this alert rule is migrated. + /// + public MetricAlertProperties(int severity, bool enabled, System.Collections.Generic.IList scopes, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, string description = default(string), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), bool? isMigrated = default(bool?)) + + { + this.Description = description; + this.Severity = severity; + this.Enabled = enabled; + this.Scopes = scopes; + this.EvaluationFrequency = evaluationFrequency; + this.WindowSize = windowSize; + this.TargetResourceType = targetResourceType; + this.TargetResourceRegion = targetResourceRegion; + this.Criteria = criteria; + this.AutoMitigate = autoMitigate; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; + this.IsMigrated = isMigrated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the metric alert that will be included in + /// the alert email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets alert severity {0, 1, 2, 3, 4} + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "severity")] + public int Severity {get; set; } + + /// + /// Gets or sets the flag that indicates whether the metric alert is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool Enabled {get; set; } + + /// + /// Gets or sets the list of resource id's that this metric alert is scoped to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scopes")] + public System.Collections.Generic.IList Scopes {get; set; } + + /// + /// Gets or sets how often the metric alert is evaluated represented in ISO + /// 8601 duration format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluationFrequency")] + 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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan WindowSize {get; set; } + + /// + /// Gets or sets the resource type of the target resource(s) on which the alert + /// is created/updated. Mandatory if the scope contains a subscription, + /// resource group, or more than one resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceType")] + public string TargetResourceType {get; set; } + + /// + /// Gets or sets the region of the target resource(s) on which the alert is + /// created/updated. Mandatory if the scope contains a subscription, resource + /// group, or more than one resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceRegion")] + public string TargetResourceRegion {get; set; } + + /// + /// Gets or sets defines the specific alert criteria information. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "criteria")] + public MetricAlertCriteria Criteria {get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert should be auto + /// resolved or not. The default is true. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoMitigate")] + public bool? AutoMitigate {get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actions")] + public System.Collections.Generic.IList Actions {get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastUpdatedTime")] + public System.DateTime? LastUpdatedTime {get; private set; } + + /// + /// Gets the value indicating whether this alert rule is migrated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMigrated")] + public bool? IsMigrated {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Scopes == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Scopes"); + } + if (this.Criteria == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Criteria"); + } + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertPropertiesPatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertPropertiesPatch.cs new file mode 100644 index 000000000000..4acccd8f7edb --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertPropertiesPatch.cs @@ -0,0 +1,182 @@ +// 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 System.Linq; + + /// + /// An alert rule properties for patch. + /// + public partial class MetricAlertPropertiesPatch + { + /// + /// Initializes a new instance of the MetricAlertPropertiesPatch class. + /// + public MetricAlertPropertiesPatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAlertPropertiesPatch class. + /// + + /// 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. + /// + + /// 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 the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + + /// the value indicating whether this alert rule is migrated. + /// + public MetricAlertPropertiesPatch(string description = default(string), int? severity = default(int?), bool? enabled = default(bool?), System.Collections.Generic.IList scopes = default(System.Collections.Generic.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?), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), bool? isMigrated = default(bool?)) + + { + this.Description = description; + this.Severity = severity; + this.Enabled = enabled; + this.Scopes = scopes; + this.EvaluationFrequency = evaluationFrequency; + this.WindowSize = windowSize; + this.TargetResourceType = targetResourceType; + this.TargetResourceRegion = targetResourceRegion; + this.Criteria = criteria; + this.AutoMitigate = autoMitigate; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; + this.IsMigrated = isMigrated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the metric alert that will be included in + /// the alert email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets alert severity {0, 1, 2, 3, 4} + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "severity")] + public int? Severity {get; set; } + + /// + /// Gets or sets the flag that indicates whether the metric alert is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool? Enabled {get; set; } + + /// + /// Gets or sets the list of resource id's that this metric alert is scoped to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scopes")] + public System.Collections.Generic.IList Scopes {get; set; } + + /// + /// Gets or sets how often the metric alert is evaluated represented in ISO + /// 8601 duration format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluationFrequency")] + 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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize {get; set; } + + /// + /// Gets or sets the resource type of the target resource(s) on which the alert + /// is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceRegion")] + public string TargetResourceRegion {get; set; } + + /// + /// Gets or sets defines the specific alert criteria information. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "criteria")] + public MetricAlertCriteria Criteria {get; set; } + + /// + /// Gets or sets the flag that indicates whether the alert should be auto + /// resolved or not. The default is true. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoMitigate")] + public bool? AutoMitigate {get; set; } + + /// + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actions")] + public System.Collections.Generic.IList Actions {get; set; } + + /// + /// Gets last time the rule was updated in ISO8601 format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastUpdatedTime")] + public System.DateTime? LastUpdatedTime {get; private set; } + + /// + /// Gets the value indicating whether this alert rule is migrated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMigrated")] + public bool? IsMigrated {get; private set; } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs index f61516f319a7..86a81e7fd02b 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The metric alert resource. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class MetricAlertResource : Resource { /// @@ -34,58 +24,86 @@ public MetricAlertResource() /// /// Initializes a new instance of the MetricAlertResource class. /// - /// Resource location - /// 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. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// 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 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 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 - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - /// 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?), bool? isMigrated = default(bool?)) - : base(location, id, name, type, tags) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// 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. + /// + + /// the resource type of the target 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 if the scope contains a subscription, resource group, or more + /// than one resource. + /// + + /// 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 the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + + /// the value indicating whether this alert rule is migrated. + /// + public MetricAlertResource(string location, int severity, bool enabled, System.Collections.Generic.IList scopes, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), bool? isMigrated = default(bool?)) + + : base(location, id, name, type, tags) { - Description = description; - Severity = severity; - Enabled = enabled; - Scopes = scopes; - EvaluationFrequency = evaluationFrequency; - WindowSize = windowSize; - TargetResourceType = targetResourceType; - TargetResourceRegion = targetResourceRegion; - Criteria = criteria; - AutoMitigate = autoMitigate; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - IsMigrated = isMigrated; + this.Description = description; + this.Severity = severity; + this.Enabled = enabled; + this.Scopes = scopes; + this.EvaluationFrequency = evaluationFrequency; + this.WindowSize = windowSize; + this.TargetResourceType = targetResourceType; + this.TargetResourceRegion = targetResourceRegion; + this.Criteria = criteria; + this.AutoMitigate = autoMitigate; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; + this.IsMigrated = isMigrated; CustomInit(); } @@ -94,112 +112,116 @@ public MetricAlertResource() /// partial void CustomInit(); + /// - /// Gets or sets the description of the metric alert that will be - /// included in the alert email. + /// Gets or sets the description of the metric alert that will be included in + /// the alert email. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets alert severity {0, 1, 2, 3, 4} /// - [JsonProperty(PropertyName = "properties.severity")] - public int Severity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.severity")] + public int Severity {get; set; } /// - /// Gets or sets the flag that indicates whether the metric alert is - /// enabled. + /// Gets or sets the flag that indicates whether the metric alert is enabled. /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled {get; set; } /// - /// Gets or sets the list of resource id's that this metric alert is - /// scoped to. + /// Gets or sets the list of resource id's that this metric alert is scoped to. /// - [JsonProperty(PropertyName = "properties.scopes")] - public IList Scopes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scopes")] + public System.Collections.Generic.IList Scopes {get; set; } /// - /// Gets or sets how often the metric alert is evaluated represented in - /// ISO 8601 duration format. + /// Gets or sets how often the metric alert is evaluated represented in ISO + /// 8601 duration format. /// - [JsonProperty(PropertyName = "properties.evaluationFrequency")] - public System.TimeSpan EvaluationFrequency { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluationFrequency")] + 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. + /// 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; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.windowSize")] + public System.TimeSpan WindowSize {get; set; } /// - /// Gets or sets the resource type of the target resource(s) on which - /// the alert is created/updated. Mandatory if the scope contains a - /// subscription, resource group, or more than one resource. + /// Gets or sets the resource type of the target resource(s) on which 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; } + [Newtonsoft.Json.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 if the scope contains a - /// subscription, resource group, or more than one resource. + /// Gets or sets the region of the target resource(s) on which the 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; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceRegion")] + public string TargetResourceRegion {get; set; } /// /// Gets or sets defines the specific alert criteria information. /// - [JsonProperty(PropertyName = "properties.criteria")] - public MetricAlertCriteria Criteria { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.criteria")] + public MetricAlertCriteria Criteria {get; set; } /// - /// Gets or sets the flag that indicates whether the alert should be - /// auto resolved or not. The default is true. + /// Gets or sets the flag that indicates whether the alert should be auto + /// resolved or not. The default is true. /// - [JsonProperty(PropertyName = "properties.autoMitigate")] - public bool? AutoMitigate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoMitigate")] + public bool? AutoMitigate {get; set; } /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.actions")] + public System.Collections.Generic.IList Actions {get; set; } /// /// Gets last time the rule was updated in ISO8601 format. /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } + [Newtonsoft.Json.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 bool? IsMigrated { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isMigrated")] + public bool? IsMigrated {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (Scopes == null) + if (this.Scopes == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Scopes"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Scopes"); } - if (Criteria == null) + if (this.Criteria == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Criteria"); } + + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs index 79942cfb0c2b..2542d0e53829 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertResourcePatch.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The metric alert resource for patch operations. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class MetricAlertResourcePatch { /// @@ -34,52 +24,72 @@ 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. - /// 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 - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - /// 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?), bool? isMigrated = default(bool?)) + + /// 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. + /// + + /// 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 the alert rule becomes active, + /// and when an alert condition is resolved. + /// + + /// Last time the rule was updated in ISO8601 format. + /// + + /// the value indicating whether this alert rule is migrated. + /// + public MetricAlertResourcePatch(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), int? severity = default(int?), bool? enabled = default(bool?), System.Collections.Generic.IList scopes = default(System.Collections.Generic.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?), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?), bool? isMigrated = default(bool?)) + { - Tags = tags; - Description = description; - Severity = severity; - Enabled = enabled; - Scopes = scopes; - EvaluationFrequency = evaluationFrequency; - WindowSize = windowSize; - TargetResourceType = targetResourceType; - TargetResourceRegion = targetResourceRegion; - Criteria = criteria; - AutoMitigate = autoMitigate; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - IsMigrated = isMigrated; + this.Tags = tags; + this.Description = description; + this.Severity = severity; + this.Enabled = enabled; + this.Scopes = scopes; + this.EvaluationFrequency = evaluationFrequency; + this.WindowSize = windowSize; + this.TargetResourceType = targetResourceType; + this.TargetResourceRegion = targetResourceRegion; + this.Criteria = criteria; + this.AutoMitigate = autoMitigate; + this.Actions = actions; + this.LastUpdatedTime = lastUpdatedTime; + this.IsMigrated = isMigrated; CustomInit(); } @@ -88,100 +98,96 @@ public MetricAlertResourcePatch() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// - /// Gets or sets the description of the metric alert that will be - /// included in the alert email. + /// Gets or sets the description of the metric alert that will be included in + /// the alert email. /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } /// /// Gets or sets alert severity {0, 1, 2, 3, 4} /// - [JsonProperty(PropertyName = "properties.severity")] - public int? Severity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.severity")] + public int? Severity {get; set; } /// - /// Gets or sets the flag that indicates whether the metric alert is - /// enabled. + /// Gets or sets the flag that indicates whether the metric alert is enabled. /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled {get; set; } /// - /// Gets or sets the list of resource id's that this metric alert is - /// scoped to. + /// Gets or sets the list of resource id's that this metric alert is scoped to. /// - [JsonProperty(PropertyName = "properties.scopes")] - public IList Scopes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scopes")] + public System.Collections.Generic.IList Scopes {get; set; } /// - /// Gets or sets how often the metric alert is evaluated represented in - /// ISO 8601 duration format. + /// Gets or sets how often the metric alert is evaluated represented in ISO + /// 8601 duration format. /// - [JsonProperty(PropertyName = "properties.evaluationFrequency")] - public System.TimeSpan? EvaluationFrequency { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluationFrequency")] + 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. + /// 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; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.windowSize")] + public System.TimeSpan? WindowSize {get; set; } /// - /// Gets or sets the resource type of the target resource(s) on which - /// the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. + /// Gets or sets the resource type of the target resource(s) on which the alert + /// is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. /// - [JsonProperty(PropertyName = "properties.targetResourceType")] - public string TargetResourceType { get; set; } + [Newtonsoft.Json.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. + /// Gets or sets the region of the target resource(s) on which the alert is + /// created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. /// - [JsonProperty(PropertyName = "properties.targetResourceRegion")] - public string TargetResourceRegion { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceRegion")] + public string TargetResourceRegion {get; set; } /// /// Gets or sets defines the specific alert criteria information. /// - [JsonProperty(PropertyName = "properties.criteria")] - public MetricAlertCriteria Criteria { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.criteria")] + public MetricAlertCriteria Criteria {get; set; } /// - /// Gets or sets the flag that indicates whether the alert should be - /// auto resolved or not. The default is true. + /// Gets or sets the flag that indicates whether the alert should be auto + /// resolved or not. The default is true. /// - [JsonProperty(PropertyName = "properties.autoMitigate")] - public bool? AutoMitigate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoMitigate")] + public bool? AutoMitigate {get; set; } /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. + /// Gets or sets the array of actions that are performed when the alert rule + /// becomes active, and when an alert condition is resolved. /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.actions")] + public System.Collections.Generic.IList Actions {get; set; } /// /// Gets last time the rule was updated in ISO8601 format. /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } + [Newtonsoft.Json.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 bool? IsMigrated { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isMigrated")] + public bool? IsMigrated {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs index bc38badfd4b5..91780773fdb8 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs @@ -1,30 +1,21 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// - /// Specifies the metric alert criteria for a single resource that has - /// multiple metric criteria. + /// Specifies the metric alert criteria for a single resource that has multiple + /// metric criteria. /// [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria")] public partial class MetricAlertSingleResourceMultipleMetricCriteria : MetricAlertCriteria { /// - /// Initializes a new instance of the - /// MetricAlertSingleResourceMultipleMetricCriteria class. + /// Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. /// public MetricAlertSingleResourceMultipleMetricCriteria() { @@ -32,17 +23,19 @@ public MetricAlertSingleResourceMultipleMetricCriteria() } /// - /// Initializes a new instance of the - /// MetricAlertSingleResourceMultipleMetricCriteria class. + /// Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. /// - /// Unmatched properties from the - /// message are deserialized this collection - /// The list of metric criteria for this 'all of' - /// operation. - public MetricAlertSingleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) - : base(additionalProperties) + + /// The rule criteria that defines the conditions of the alert rule. + /// + + /// The list of metric criteria for this 'all of' operation. + /// + public MetricAlertSingleResourceMultipleMetricCriteria(System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allOf = default(System.Collections.Generic.IList)) + + : base(additionalProperties) { - AllOf = allOf; + this.AllOf = allOf; CustomInit(); } @@ -51,12 +44,11 @@ public MetricAlertSingleResourceMultipleMetricCriteria() /// partial void CustomInit(); + /// - /// Gets or sets the list of metric criteria for this 'all of' - /// operation. + /// Gets or sets the list of metric criteria for this 'all of' operation. /// - [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "allOf")] + public System.Collections.Generic.IList AllOf {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs index f09809a7535e..06fe47e765fc 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatus.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,17 +23,25 @@ public MetricAlertStatus() /// /// Initializes a new instance of the MetricAlertStatus class. /// - /// The status name. - /// The alert rule arm id. - /// The extended resource type name. - /// The alert status properties of the metric - /// alert status. + + /// The status name. + /// + + /// The alert rule arm id. + /// + + /// The extended resource type name. + /// + + /// The alert status properties of the metric alert status. + /// public MetricAlertStatus(string name = default(string), string id = default(string), string type = default(string), MetricAlertStatusProperties properties = default(MetricAlertStatusProperties)) + { - Name = name; - Id = id; - Type = type; - Properties = properties; + this.Name = name; + this.Id = id; + this.Type = type; + this.Properties = properties; CustomInit(); } @@ -48,30 +50,29 @@ public MetricAlertStatus() /// partial void CustomInit(); + /// /// Gets or sets the status name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets the alert rule arm id. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// /// Gets or sets the extended resource type name. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } /// - /// Gets or sets the alert status properties of the metric alert - /// status. + /// Gets or sets the alert status properties of the metric alert status. /// - [JsonProperty(PropertyName = "properties")] - public MetricAlertStatusProperties Properties { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public MetricAlertStatusProperties Properties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs index 461d2b441d0b..a7c80c8050b2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusCollection.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class MetricAlertStatusCollection { /// - /// Initializes a new instance of the MetricAlertStatusCollection - /// class. + /// Initializes a new instance of the MetricAlertStatusCollection class. /// public MetricAlertStatusCollection() { @@ -30,14 +21,15 @@ public MetricAlertStatusCollection() } /// - /// Initializes a new instance of the MetricAlertStatusCollection - /// class. + /// Initializes a new instance of the MetricAlertStatusCollection class. /// - /// the values for the alert rule - /// resources. - public MetricAlertStatusCollection(IList value = default(IList)) + + /// the values for the alert rule resources. + /// + public MetricAlertStatusCollection(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + { - Value = value; + this.Value = value; CustomInit(); } @@ -46,11 +38,11 @@ public MetricAlertStatusCollection() /// partial void CustomInit(); + /// /// Gets or sets the values for the alert rule resources. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs index ba3dedbad37d..424fe75f6a7e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAlertStatusProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class MetricAlertStatusProperties { /// - /// Initializes a new instance of the MetricAlertStatusProperties - /// class. + /// Initializes a new instance of the MetricAlertStatusProperties class. /// public MetricAlertStatusProperties() { @@ -30,19 +21,23 @@ public MetricAlertStatusProperties() } /// - /// Initializes a new instance of the MetricAlertStatusProperties - /// class. + /// Initializes a new instance of the MetricAlertStatusProperties class. /// - /// An object describing the type of the - /// dimensions. - /// status value - /// UTC time when the status was - /// checked. - public MetricAlertStatusProperties(IDictionary dimensions = default(IDictionary), string status = default(string), System.DateTime? timestamp = default(System.DateTime?)) + + /// An object describing the type of the dimensions. + /// + + /// status value + /// + + /// UTC time when the status was checked. + /// + public MetricAlertStatusProperties(System.Collections.Generic.IDictionary dimensions = default(System.Collections.Generic.IDictionary), string status = default(string), System.DateTime? timestamp = default(System.DateTime?)) + { - Dimensions = dimensions; - Status = status; - Timestamp = timestamp; + this.Dimensions = dimensions; + this.Status = status; + this.Timestamp = timestamp; CustomInit(); } @@ -51,23 +46,23 @@ public MetricAlertStatusProperties() /// partial void CustomInit(); + /// /// Gets or sets an object describing the type of the dimensions. /// - [JsonProperty(PropertyName = "dimensions")] - public IDictionary Dimensions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dimensions")] + public System.Collections.Generic.IDictionary Dimensions {get; set; } /// /// Gets or sets status value /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// - /// Gets or sets UTC time when the status was checked. + /// Gets or sets uTC time when the status was checked. /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "timestamp")] + public System.DateTime? Timestamp {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs index c60ef65fd5e1..338d3b389bdf 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricAvailability.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,16 +24,19 @@ public MetricAvailability() /// /// Initializes a new instance of the MetricAvailability class. /// - /// the time grain specifies the aggregation - /// interval for the metric. Expressed as a duration 'PT1M', 'P1D', - /// etc. - /// the retention period for the metric at the - /// specified timegrain. Expressed as a duration 'PT1M', 'P1D', - /// etc. + + /// the time grain specifies the aggregation interval for the metric. Expressed + /// as a duration 'PT1M', 'P1D', etc. + /// + + /// the retention period for the metric at the specified timegrain. Expressed + /// as a duration 'PT1M', 'P1D', etc. + /// public MetricAvailability(System.TimeSpan? timeGrain = default(System.TimeSpan?), System.TimeSpan? retention = default(System.TimeSpan?)) + { - TimeGrain = timeGrain; - Retention = retention; + this.TimeGrain = timeGrain; + this.Retention = retention; CustomInit(); } @@ -48,19 +45,19 @@ public MetricAvailability() /// partial void CustomInit(); + /// - /// Gets or sets the time grain specifies the aggregation interval for - /// the metric. Expressed as a duration 'PT1M', 'P1D', etc. + /// Gets or sets the time grain specifies the aggregation interval for the + /// metric. Expressed as a duration 'PT1M', 'P1D', etc. /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan? TimeGrain { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan? TimeGrain {get; set; } /// /// Gets or sets the retention period for the metric at the specified - /// timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + /// timegrain. Expressed as a duration 'PT1M', 'P1D', etc. /// - [JsonProperty(PropertyName = "retention")] - public System.TimeSpan? Retention { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "retention")] + public System.TimeSpan? Retention {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricBaselinesProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricBaselinesProperties.cs new file mode 100644 index 000000000000..036cea85d35b --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricBaselinesProperties.cs @@ -0,0 +1,117 @@ +// 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 System.Linq; + + /// + /// The response to a metric baselines query. + /// + public partial class MetricBaselinesProperties + { + /// + /// Initializes a new instance of the MetricBaselinesProperties class. + /// + public MetricBaselinesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricBaselinesProperties class. + /// + + /// The timespan for which the data was retrieved. Its value consists of two + /// datetimes concatenated, separated by '/'. This may be adjusted in the + /// future and returned back from what was originally requested. + /// + + /// The interval (window size) for which the metric data was returned in. This + /// may be adjusted in the future and returned back from what was originally + /// requested. This is not present if a metadata request was made. + /// + + /// The namespace of the metrics been queried. + /// + + /// The baseline for each time series that was queried. + /// + public MetricBaselinesProperties(string timespan, System.TimeSpan interval, System.Collections.Generic.IList baselines, string namespaceProperty = default(string)) + + { + this.Timespan = timespan; + this.Interval = interval; + this.NamespaceProperty = namespaceProperty; + this.Baselines = baselines; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the timespan for which the data was retrieved. Its value + /// consists of two datetimes concatenated, separated by '/'. This may be + /// adjusted in the future and returned back from what was originally + /// requested. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timespan")] + public string Timespan {get; set; } + + /// + /// Gets or sets the interval (window size) for which the metric data was + /// returned in. This may be adjusted in the future and returned back from + /// what was originally requested. This is not present if a metadata request + /// was made. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "interval")] + public System.TimeSpan Interval {get; set; } + + /// + /// Gets or sets the namespace of the metrics been queried. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty {get; set; } + + /// + /// Gets or sets the baseline for each time series that was queried. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "baselines")] + public System.Collections.Generic.IList Baselines {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Timespan == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Timespan"); + } + if (this.Baselines == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Baselines"); + } + + + if (this.Baselines != null) + { + foreach (var element in this.Baselines) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs index 378581566094..2c5a9c965b8a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricClass.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for MetricClass. /// + + public static class MetricClass { public const string Availability = "Availability"; @@ -22,4 +19,4 @@ public static class MetricClass public const string Latency = "Latency"; public const string Saturation = "Saturation"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs index 99e60d8084f0..546f0fe44612 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -33,28 +24,38 @@ public MetricCriteria() /// /// Initializes a new instance of the MetricCriteria class. /// - /// Name of the criteria. - /// Name of the metric. + + /// Name of the criteria. + /// + + /// Name of the metric. + /// + + /// Namespace of the metric. + /// + /// the criteria time aggregation types. - /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', - /// 'Total' - /// the criteria operator. Possible - /// values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', - /// 'LessThan', 'LessThanOrEqual' - /// the criteria threshold value that activates - /// the alert. - /// Unmatched properties from the - /// message are deserialized this collection - /// Namespace of the metric. - /// List of dimension conditions. - /// 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, 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) + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + + /// List of dimension conditions. + /// + + /// Allows creating an alert rule on a custom metric that isn't yet emitted, by + /// causing the metric validation to be skipped. + /// + + /// the criteria operator. + /// Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', + /// 'LessThan', 'LessThanOrEqual' + + /// the criteria threshold value that activates the alert. + /// + public MetricCriteria(string name, string metricName, string timeAggregation, string operatorProperty, double threshold, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) + + : base(name, metricName, timeAggregation, metricNamespace, dimensions, skipMetricValidation) { - OperatorProperty = operatorProperty; - Threshold = threshold; + this.OperatorProperty = operatorProperty; + this.Threshold = threshold; CustomInit(); } @@ -63,33 +64,32 @@ public MetricCriteria() /// partial void CustomInit(); + /// - /// Gets or sets the criteria operator. Possible values include: - /// 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - /// 'LessThanOrEqual' + /// Gets or sets the criteria operator. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public string OperatorProperty {get; set; } /// /// Gets or sets the criteria threshold value that activates the alert. /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public double Threshold {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (OperatorProperty == null) + if (this.OperatorProperty == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OperatorProperty"); } + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs index 84d38c86e0b4..ec01a413de9e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDefinition.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,52 +23,68 @@ public MetricDefinition() /// /// Initializes a new instance of the MetricDefinition class. /// - /// Flag to indicate whether the - /// dimension is required. - /// the resource identifier of the resource - /// that emitted the metric. - /// the namespace the metric belongs - /// to. - /// the name and the display name of the metric, - /// i.e. it is a localizable string. - /// Detailed description of this - /// metric. - /// Custom category name for this - /// metric. - /// The class of the metric. Possible values - /// include: 'Availability', 'Transactions', 'Errors', 'Latency', - /// 'Saturation' - /// The unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// the primary aggregation type - /// value defining how to use the values for display. Possible values - /// include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', - /// 'Total' - /// the collection of what - /// aggregation types are supported. - /// the collection of what - /// aggregation intervals are available to be queried. - /// the resource identifier of the metric - /// definition. - /// the name and the display name of the - /// dimension, i.e. it is a localizable string. - public MetricDefinition(bool? isDimensionRequired = default(bool?), string resourceId = default(string), string namespaceProperty = default(string), LocalizableString name = default(LocalizableString), string displayDescription = default(string), string category = default(string), string metricClass = default(string), string unit = default(string), AggregationType? primaryAggregationType = default(AggregationType?), IList supportedAggregationTypes = default(IList), IList metricAvailabilities = default(IList), string id = default(string), IList dimensions = default(IList)) + + /// Flag to indicate whether the dimension is required. + /// + + /// the resource identifier of the resource that emitted the metric. + /// + + /// the namespace the metric belongs to. + /// + + /// the name and the display name of the metric, i.e. it is a localizable + /// string. + /// + + /// Detailed description of this metric. + /// + + /// Custom category name for this metric. + /// + + /// The class of the metric. + /// Possible values include: 'Availability', 'Transactions', 'Errors', + /// 'Latency', 'Saturation' + + /// The unit of the metric. + /// Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', + /// 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', + /// 'Cores', 'MilliCores', 'NanoCores', 'BitsPerSecond' + + /// the primary aggregation type value defining how to use the values for + /// display. + /// Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', + /// 'Total' + + /// the collection of what aggregation types are supported. + /// + + /// the collection of what aggregation intervals are available to be queried. + /// + + /// the resource identifier of the metric definition. + /// + + /// the name and the display name of the dimension, i.e. it is a localizable + /// string. + /// + public MetricDefinition(bool? isDimensionRequired = default(bool?), string resourceId = default(string), string namespaceProperty = default(string), LocalizableString name = default(LocalizableString), string displayDescription = default(string), string category = default(string), string metricClass = default(string), string unit = default(string), AggregationType? primaryAggregationType = default(AggregationType?), System.Collections.Generic.IList supportedAggregationTypes = default(System.Collections.Generic.IList), System.Collections.Generic.IList metricAvailabilities = default(System.Collections.Generic.IList), string id = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList)) + { - IsDimensionRequired = isDimensionRequired; - ResourceId = resourceId; - NamespaceProperty = namespaceProperty; - Name = name; - DisplayDescription = displayDescription; - Category = category; - MetricClass = metricClass; - Unit = unit; - PrimaryAggregationType = primaryAggregationType; - SupportedAggregationTypes = supportedAggregationTypes; - MetricAvailabilities = metricAvailabilities; - Id = id; - Dimensions = dimensions; + this.IsDimensionRequired = isDimensionRequired; + this.ResourceId = resourceId; + this.NamespaceProperty = namespaceProperty; + this.Name = name; + this.DisplayDescription = displayDescription; + this.Category = category; + this.MetricClass = metricClass; + this.Unit = unit; + this.PrimaryAggregationType = primaryAggregationType; + this.SupportedAggregationTypes = supportedAggregationTypes; + this.MetricAvailabilities = metricAvailabilities; + this.Id = id; + this.Dimensions = dimensions; CustomInit(); } @@ -85,110 +93,114 @@ public MetricDefinition() /// partial void CustomInit(); + /// /// Gets or sets flag to indicate whether the dimension is required. /// - [JsonProperty(PropertyName = "isDimensionRequired")] - public bool? IsDimensionRequired { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "isDimensionRequired")] + public bool? IsDimensionRequired {get; set; } /// - /// Gets or sets the resource identifier of the resource that emitted - /// the metric. + /// Gets or sets the resource identifier of the resource that emitted the + /// metric. /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } /// /// Gets or sets the namespace the metric belongs to. /// - [JsonProperty(PropertyName = "namespace")] - public string NamespaceProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty {get; set; } /// - /// Gets or sets the name and the display name of the metric, i.e. it - /// is a localizable string. + /// Gets or sets the name and the display name of the metric, i.e. it is a + /// localizable string. /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public LocalizableString Name {get; set; } /// /// Gets or sets detailed description of this metric. /// - [JsonProperty(PropertyName = "displayDescription")] - public string DisplayDescription { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription {get; set; } /// /// Gets or sets custom category name for this metric. /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; set; } /// - /// Gets or sets the class of the metric. Possible values include: - /// 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + /// Gets or sets the class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' /// - [JsonProperty(PropertyName = "metricClass")] - public string MetricClass { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricClass")] + public string MetricClass {get; set; } /// - /// Gets or sets the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' + /// Gets or sets the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', 'MilliCores', 'NanoCores', 'BitsPerSecond' /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "unit")] + public string Unit {get; set; } /// - /// Gets or sets the primary aggregation type value defining how to use - /// the values for display. Possible values include: 'None', 'Average', - /// 'Count', 'Minimum', 'Maximum', 'Total' + /// Gets or sets the primary aggregation type value defining how to use the + /// values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' /// - [JsonProperty(PropertyName = "primaryAggregationType")] - public AggregationType? PrimaryAggregationType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "primaryAggregationType")] + public AggregationType? PrimaryAggregationType {get; set; } /// - /// Gets or sets the collection of what aggregation types are - /// supported. + /// Gets or sets the collection of what aggregation types are supported. /// - [JsonProperty(PropertyName = "supportedAggregationTypes")] - public IList SupportedAggregationTypes { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "supportedAggregationTypes")] + public System.Collections.Generic.IList SupportedAggregationTypes {get; set; } /// - /// Gets or sets the collection of what aggregation intervals are - /// available to be queried. + /// Gets or sets the collection of what aggregation intervals are available to + /// be queried. /// - [JsonProperty(PropertyName = "metricAvailabilities")] - public IList MetricAvailabilities { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricAvailabilities")] + public System.Collections.Generic.IList MetricAvailabilities {get; set; } /// /// Gets or sets the resource identifier of the metric definition. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// - /// Gets or sets the name and the display name of the dimension, i.e. - /// it is a localizable string. + /// Gets or sets the name and the display name of the dimension, i.e. it is a + /// localizable string. /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "dimensions")] + public System.Collections.Generic.IList Dimensions {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name != null) + + + if (this.Name != null) { - Name.Validate(); + this.Name.Validate(); } - if (Dimensions != null) + + + + + + + + + if (this.Dimensions != null) { - foreach (var element in Dimensions) + foreach (var element in this.Dimensions) { if (element != null) { @@ -198,4 +210,4 @@ public virtual void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs index 89e83546e09f..3011270632cf 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricDimension.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,15 +23,21 @@ public MetricDimension() /// /// Initializes a new instance of the MetricDimension class. /// - /// Name of the dimension. - /// the dimension operator. Only - /// 'Include' and 'Exclude' are supported - /// list of dimension values. - public MetricDimension(string name, string operatorProperty, IList values) + + /// Name of the dimension. + /// + + /// the dimension operator. Only 'Include' and 'Exclude' are supported + /// + + /// list of dimension values. + /// + public MetricDimension(string name, string operatorProperty, System.Collections.Generic.IList values) + { - Name = name; - OperatorProperty = operatorProperty; - Values = values; + this.Name = name; + this.OperatorProperty = operatorProperty; + this.Values = values; CustomInit(); } @@ -49,45 +46,48 @@ public MetricDimension(string name, string operatorProperty, IList value /// partial void CustomInit(); + /// /// Gets or sets name of the dimension. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// - /// Gets or sets the dimension operator. Only 'Include' and 'Exclude' - /// are supported + /// Gets or sets the dimension operator. Only 'Include' and 'Exclude' are + /// supported /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public string OperatorProperty {get; set; } /// /// Gets or sets list of dimension values. /// - [JsonProperty(PropertyName = "values")] - public IList Values { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "values")] + public System.Collections.Generic.IList Values {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (OperatorProperty == null) + if (this.OperatorProperty == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OperatorProperty"); } - if (Values == null) + if (this.Values == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Values"); } + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs index 4cfc95c792a5..1b426714ebd9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespace.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,20 +23,29 @@ public MetricNamespace() /// /// Initializes a new instance of the MetricNamespace class. /// - /// The ID of the metric namespace. - /// The type of the namespace. - /// The escaped name of the namespace. - /// Kind of namespace. Possible values - /// include: 'Platform', 'Custom', 'Qos' - /// Properties which include the fully - /// qualified namespace name. + + /// The ID of the metric namespace. + /// + + /// The type of the namespace. + /// + + /// The escaped name of the namespace. + /// + + /// Kind of namespace + /// Possible values include: 'Platform', 'Custom', 'Qos' + + /// Properties which include the fully qualified namespace name. + /// public MetricNamespace(string id = default(string), string type = default(string), string name = default(string), string classification = default(string), MetricNamespaceName properties = default(MetricNamespaceName)) + { - Id = id; - Type = type; - Name = name; - Classification = classification; - Properties = properties; + this.Id = id; + this.Type = type; + this.Name = name; + this.Classification = classification; + this.Properties = properties; CustomInit(); } @@ -51,37 +54,35 @@ public MetricNamespace() /// partial void CustomInit(); + /// /// Gets or sets the ID of the metric namespace. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// /// Gets or sets the type of the namespace. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } /// /// Gets or sets the escaped name of the namespace. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// - /// Gets or sets kind of namespace. Possible values include: - /// 'Platform', 'Custom', 'Qos' + /// Gets or sets kind of namespace Possible values include: 'Platform', 'Custom', 'Qos' /// - [JsonProperty(PropertyName = "classification")] - public string Classification { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "classification")] + public string Classification {get; set; } /// - /// Gets or sets properties which include the fully qualified namespace - /// name. + /// Gets or sets properties which include the fully qualified namespace name. /// - [JsonProperty(PropertyName = "properties")] - public MetricNamespaceName Properties { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public MetricNamespaceName Properties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs index 1415eb1300a4..63bdf93a499f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricNamespaceName.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,11 +23,13 @@ public MetricNamespaceName() /// /// Initializes a new instance of the MetricNamespaceName class. /// - /// The metric namespace - /// name. + + /// The metric namespace name. + /// public MetricNamespaceName(string metricNamespaceNameProperty = default(string)) + { - MetricNamespaceNameProperty = metricNamespaceNameProperty; + this.MetricNamespaceNameProperty = metricNamespaceNameProperty; CustomInit(); } @@ -42,11 +38,11 @@ public MetricNamespaceName() /// partial void CustomInit(); + /// /// Gets or sets the metric namespace name. /// - [JsonProperty(PropertyName = "metricNamespaceName")] - public string MetricNamespaceNameProperty { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "metricNamespaceName")] + public string MetricNamespaceNameProperty {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs index bf7657b2a3b8..35b48066e325 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSettings.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,22 +24,27 @@ public MetricSettings() /// /// Initializes a new instance of the MetricSettings class. /// - /// a value indicating whether this category is - /// enabled. - /// the timegrain of the metric in ISO8601 - /// format. - /// Name of a Diagnostic Metric category for a - /// resource type this setting is applied to. To obtain the list of - /// Diagnostic metric categories for a resource, first perform a GET - /// diagnostic settings operation. - /// the retention policy for this - /// category. + + /// the timegrain of the metric in ISO8601 format. + /// + + /// Name of a Diagnostic Metric category for a resource type this setting is + /// applied to. To obtain the list of Diagnostic metric categories for a + /// resource, first perform a GET diagnostic settings operation. + /// + + /// a value indicating whether this category is enabled. + /// + + /// the retention policy for this category. + /// public MetricSettings(bool enabled, System.TimeSpan? timeGrain = default(System.TimeSpan?), string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) + { - TimeGrain = timeGrain; - Category = category; - Enabled = enabled; - RetentionPolicy = retentionPolicy; + this.TimeGrain = timeGrain; + this.Category = category; + this.Enabled = enabled; + this.RetentionPolicy = retentionPolicy; CustomInit(); } @@ -54,45 +53,45 @@ public MetricSettings() /// partial void CustomInit(); + /// /// Gets or sets the timegrain of the metric in ISO8601 format. /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan? TimeGrain { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan? TimeGrain {get; set; } /// - /// Gets or sets name of a Diagnostic Metric category for a resource - /// type this setting is applied to. To obtain the list of Diagnostic - /// metric categories for a resource, first perform a GET diagnostic - /// settings operation. + /// Gets or sets name of a Diagnostic Metric category for a resource type this + /// setting is applied to. To obtain the list of Diagnostic metric categories + /// for a resource, first perform a GET diagnostic settings operation. /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; set; } /// /// Gets or sets a value indicating whether this category is enabled. /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool Enabled {get; set; } /// /// Gets or sets the retention policy for this category. /// - [JsonProperty(PropertyName = "retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "retentionPolicy")] + public RetentionPolicy RetentionPolicy {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (RetentionPolicy != null) + + if (this.RetentionPolicy != null) { - RetentionPolicy.Validate(); + this.RetentionPolicy.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs index b80789586206..c9aaf475b3d1 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricSingleDimension.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,12 +23,17 @@ public MetricSingleDimension() /// /// Initializes a new instance of the MetricSingleDimension class. /// - /// Name of the dimension. - /// Value of the dimension. + + /// Name of the dimension. + /// + + /// Value of the dimension. + /// public MetricSingleDimension(string name, string value) + { - Name = name; - Value = value; + this.Name = name; + this.Value = value; CustomInit(); } @@ -44,34 +42,36 @@ public MetricSingleDimension(string name, string value) /// partial void CustomInit(); + /// /// Gets or sets name of the dimension. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets value of the dimension. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (Value == null) + if (this.Value == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); } + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs index 241b24be5fe9..e9a5acf74315 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricStatisticType.cs @@ -1,35 +1,28 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for MetricStatisticType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum MetricStatisticType { - [EnumMember(Value = "Average")] + [System.Runtime.Serialization.EnumMember(Value = "Average")] Average, - [EnumMember(Value = "Min")] + [System.Runtime.Serialization.EnumMember(Value = "Min")] Min, - [EnumMember(Value = "Max")] + [System.Runtime.Serialization.EnumMember(Value = "Max")] Max, - [EnumMember(Value = "Sum")] + [System.Runtime.Serialization.EnumMember(Value = "Sum")] Sum, - [EnumMember(Value = "Count")] + [System.Runtime.Serialization.EnumMember(Value = "Count")] Count } internal static class MetricStatisticTypeEnumExtension @@ -38,7 +31,6 @@ internal static string ToSerializedValue(this MetricStatisticType? value) { return value == null ? null : ((MetricStatisticType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this MetricStatisticType value) { switch( value ) @@ -56,7 +48,6 @@ internal static string ToSerializedValue(this MetricStatisticType value) } return null; } - internal static MetricStatisticType? ParseMetricStatisticType(this string value) { switch( value ) @@ -75,4 +66,4 @@ internal static string ToSerializedValue(this MetricStatisticType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs index dc19e4db4a29..926f05832b91 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricTrigger.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,53 +23,66 @@ public MetricTrigger() /// /// Initializes a new instance of the MetricTrigger class. /// - /// the name of the metric that defines what - /// the rule monitors. - /// the resource identifier of the - /// resource the rule monitors. - /// the granularity of metrics the rule - /// monitors. Must be one of the predefined values returned from metric - /// definitions for the metric. Must be between 12 hours and 1 - /// minute. - /// the metric statistic type. How the metrics - /// from multiple instances are combined. Possible values include: - /// 'Average', 'Min', 'Max', 'Sum', 'Count' - /// the range of time in which instance data - /// is collected. This value must be greater than the delay in metric - /// collection, which can vary from resource-to-resource. Must be - /// between 12 hours and 5 minutes. - /// time aggregation type. How the data - /// that is collected should be combined over time. The default value - /// is Average. Possible values include: 'Average', 'Minimum', - /// 'Maximum', 'Total', 'Count', 'Last' - /// the operator that is used to compare - /// the metric data and the threshold. Possible values include: - /// 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', - /// 'LessThan', 'LessThanOrEqual' - /// the threshold of the metric that triggers - /// the scale action. - /// the namespace of the metric that - /// defines what the rule monitors. - /// the location of the resource - /// the rule monitors. + + /// the name of the metric that defines what the rule monitors. + /// + + /// the namespace of the metric that defines what the rule monitors. + /// + + /// the resource identifier of the resource the rule monitors. + /// + + /// the location of the resource the rule monitors. + /// + + /// the granularity of metrics the rule monitors. Must be one of the predefined + /// values returned from metric definitions for the metric. Must be between 12 + /// hours and 1 minute. + /// + + /// the metric statistic type. How the metrics from multiple instances are + /// combined. + /// Possible values include: 'Average', 'Min', 'Max', 'Sum', 'Count' + + /// the range of time in which instance data is collected. This value must be + /// greater than the delay in metric collection, which can vary from + /// resource-to-resource. Must be between 12 hours and 5 minutes. + /// + + /// time aggregation type. How the data that is collected should be combined + /// over time. The default value is Average. + /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', + /// 'Last' + + /// the operator that is used to compare the metric data and the threshold. + /// Possible values include: 'Equals', 'NotEquals', 'GreaterThan', + /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + + /// the threshold of the metric that triggers the scale action. + /// + /// List of dimension conditions. For example: - /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - /// a value indicating whether metric - /// should divide per instance. - public MetricTrigger(string metricName, string metricResourceUri, System.TimeSpan timeGrain, MetricStatisticType statistic, System.TimeSpan timeWindow, TimeAggregationType timeAggregation, ComparisonOperationType operatorProperty, double threshold, string metricNamespace = default(string), string metricResourceLocation = default(string), IList dimensions = default(IList), bool? dividePerInstance = default(bool?)) + /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + /// + + /// a value indicating whether metric should divide per instance. + /// + public MetricTrigger(string metricName, string metricResourceUri, System.TimeSpan timeGrain, MetricStatisticType statistic, System.TimeSpan timeWindow, TimeAggregationType timeAggregation, ComparisonOperationType operatorProperty, double threshold, string metricNamespace = default(string), string metricResourceLocation = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? dividePerInstance = default(bool?)) + { - MetricName = metricName; - MetricNamespace = metricNamespace; - MetricResourceUri = metricResourceUri; - MetricResourceLocation = metricResourceLocation; - TimeGrain = timeGrain; - Statistic = statistic; - TimeWindow = timeWindow; - TimeAggregation = timeAggregation; - OperatorProperty = operatorProperty; - Threshold = threshold; - Dimensions = dimensions; - DividePerInstance = dividePerInstance; + this.MetricName = metricName; + this.MetricNamespace = metricNamespace; + this.MetricResourceUri = metricResourceUri; + this.MetricResourceLocation = metricResourceLocation; + this.TimeGrain = timeGrain; + this.Statistic = statistic; + this.TimeWindow = timeWindow; + this.TimeAggregation = timeAggregation; + this.OperatorProperty = operatorProperty; + this.Threshold = threshold; + this.Dimensions = dimensions; + this.DividePerInstance = dividePerInstance; CustomInit(); } @@ -87,115 +91,113 @@ public MetricTrigger() /// partial void CustomInit(); + /// - /// Gets or sets the name of the metric that defines what the rule - /// monitors. + /// Gets or sets the name of the metric that defines what the rule monitors. /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricName")] + public string MetricName {get; set; } /// /// Gets or sets the namespace of the metric that defines what the rule /// monitors. /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace {get; set; } /// - /// Gets or sets the resource identifier of the resource the rule - /// monitors. + /// Gets or sets the resource identifier of the resource the rule monitors. /// - [JsonProperty(PropertyName = "metricResourceUri")] - public string MetricResourceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricResourceUri")] + public string MetricResourceUri {get; set; } /// /// Gets or sets the location of the resource the rule monitors. /// - [JsonProperty(PropertyName = "metricResourceLocation")] - public string MetricResourceLocation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricResourceLocation")] + public string MetricResourceLocation {get; set; } /// - /// Gets or sets the granularity of metrics the rule monitors. Must be - /// one of the predefined values returned from metric definitions for - /// the metric. Must be between 12 hours and 1 minute. + /// Gets or sets the granularity of metrics the rule monitors. Must be one of + /// the predefined values returned from metric definitions for the metric. Must + /// be between 12 hours and 1 minute. /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan TimeGrain { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeGrain")] + public System.TimeSpan TimeGrain {get; set; } /// - /// Gets or sets the metric statistic type. How the metrics from - /// multiple instances are combined. Possible values include: - /// 'Average', 'Min', 'Max', 'Sum', 'Count' + /// Gets or sets the metric statistic type. How the metrics from multiple + /// instances are combined. Possible values include: 'Average', 'Min', 'Max', 'Sum', 'Count' /// - [JsonProperty(PropertyName = "statistic")] - public MetricStatisticType Statistic { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "statistic")] + public MetricStatisticType Statistic {get; set; } /// - /// Gets or sets the range of time in which instance data is collected. - /// This value must be greater than the delay in metric collection, - /// which can vary from resource-to-resource. Must be between 12 hours - /// and 5 minutes. + /// Gets or sets the range of time in which instance data is collected. This + /// value must be greater than the delay in metric collection, which can vary + /// from resource-to-resource. Must be between 12 hours and 5 minutes. /// - [JsonProperty(PropertyName = "timeWindow")] - public System.TimeSpan TimeWindow { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeWindow")] + public System.TimeSpan TimeWindow {get; set; } /// - /// Gets or sets time aggregation type. How the data that is collected - /// should be combined over time. The default value is Average. - /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', - /// 'Count', 'Last' + /// Gets or sets time aggregation type. How the data that is collected should + /// be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last' /// - [JsonProperty(PropertyName = "timeAggregation")] - public TimeAggregationType TimeAggregation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeAggregation")] + public TimeAggregationType TimeAggregation {get; set; } /// - /// Gets or sets the operator that is used to compare the metric data - /// and the threshold. Possible values include: 'Equals', 'NotEquals', - /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// Gets or sets the operator that is used to compare the metric data and the + /// threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' /// - [JsonProperty(PropertyName = "operator")] - public ComparisonOperationType OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public ComparisonOperationType OperatorProperty {get; set; } /// - /// Gets or sets the threshold of the metric that triggers the scale - /// action. + /// Gets or sets the threshold of the metric that triggers the scale action. /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public double Threshold {get; set; } /// /// Gets or sets list of dimension conditions. For example: - /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dimensions")] + public System.Collections.Generic.IList Dimensions {get; set; } /// - /// Gets or sets a value indicating whether metric should divide per - /// instance. + /// Gets or sets a value indicating whether metric should divide per instance. /// - [JsonProperty(PropertyName = "dividePerInstance")] - public bool? DividePerInstance { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "dividePerInstance")] + public bool? DividePerInstance {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (MetricName == null) + if (this.MetricName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "MetricName"); } - if (MetricResourceUri == null) + if (this.MetricResourceUri == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricResourceUri"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "MetricResourceUri"); } - if (Dimensions != null) + + + + + + + + if (this.Dimensions != null) { - foreach (var element in Dimensions) + foreach (var element in this.Dimensions) { if (element != null) { @@ -205,4 +207,4 @@ public virtual void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs index b1233d95500c..7a84f3998d93 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricUnit.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for MetricUnit. /// + + public static class MetricUnit { public const string Count = "Count"; @@ -30,4 +27,4 @@ public static class MetricUnit public const string NanoCores = "NanoCores"; public const string BitsPerSecond = "BitsPerSecond"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs index 01180a7f2634..79633f7cc5a4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricValue.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,24 +23,34 @@ public MetricValue() /// /// Initializes a new instance of the MetricValue class. /// - /// the timestamp for the metric value in ISO - /// 8601 format. - /// the average value in the time range. - /// the least value in the time range. - /// the greatest value in the time range. - /// the sum of all of the values in the time - /// range. - /// the number of samples in the time range. Can be - /// used to determine the number of values that contributed to the - /// average value. + + /// the timestamp for the metric value in ISO 8601 format. + /// + + /// the average value in the time range. + /// + + /// the least value in the time range. + /// + + /// the greatest value in the time range. + /// + + /// the sum of all of the values in the time range. + /// + + /// the number of samples in the time range. Can be used to determine the + /// number of values that contributed to the average value. + /// public MetricValue(System.DateTime timeStamp, double? average = default(double?), double? minimum = default(double?), double? maximum = default(double?), double? total = default(double?), double? count = default(double?)) + { - TimeStamp = timeStamp; - Average = average; - Minimum = minimum; - Maximum = maximum; - Total = total; - Count = count; + this.TimeStamp = timeStamp; + this.Average = average; + this.Minimum = minimum; + this.Maximum = maximum; + this.Total = total; + this.Count = count; CustomInit(); } @@ -55,48 +59,47 @@ public MetricValue() /// partial void CustomInit(); + /// /// Gets or sets the timestamp for the metric value in ISO 8601 format. /// - [JsonProperty(PropertyName = "timeStamp")] - public System.DateTime TimeStamp { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeStamp")] + public System.DateTime TimeStamp {get; set; } /// /// Gets or sets the average value in the time range. /// - [JsonProperty(PropertyName = "average")] - public double? Average { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "average")] + public double? Average {get; set; } /// /// Gets or sets the least value in the time range. /// - [JsonProperty(PropertyName = "minimum")] - public double? Minimum { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "minimum")] + public double? Minimum {get; set; } /// /// Gets or sets the greatest value in the time range. /// - [JsonProperty(PropertyName = "maximum")] - public double? Maximum { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "maximum")] + public double? Maximum {get; set; } /// /// Gets or sets the sum of all of the values in the time range. /// - [JsonProperty(PropertyName = "total")] - public double? Total { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "total")] + public double? Total {get; set; } /// - /// Gets or sets the number of samples in the time range. Can be used - /// to determine the number of values that contributed to the average - /// value. + /// Gets or sets the number of samples in the time range. Can be used to + /// determine the number of values that contributed to the average value. /// - [JsonProperty(PropertyName = "count")] - public double? Count { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "count")] + public double? Count {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() @@ -104,4 +107,4 @@ public virtual void Validate() //Nothing to validate } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs index ed17c02e18d6..5566431ceb4e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -33,27 +24,34 @@ public MultiMetricCriteria() /// /// Initializes a new instance of the MultiMetricCriteria class. /// - /// Name of the criteria. - /// Name of the metric. + + /// Name of the criteria. + /// + + /// Name of the metric. + /// + + /// Namespace of the metric. + /// + /// 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. - /// List of dimension conditions. - /// 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, string timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) + /// Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + + /// List of dimension conditions. + /// + + /// 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, string timeAggregation, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) + { - AdditionalProperties = additionalProperties; - Name = name; - MetricName = metricName; - MetricNamespace = metricNamespace; - TimeAggregation = timeAggregation; - Dimensions = dimensions; - SkipMetricValidation = skipMetricValidation; + this.Name = name; + this.MetricName = metricName; + this.MetricNamespace = metricNamespace; + this.TimeAggregation = timeAggregation; + this.Dimensions = dimensions; + this.SkipMetricValidation = skipMetricValidation; CustomInit(); } @@ -62,74 +60,70 @@ public MultiMetricCriteria() /// partial void CustomInit(); - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } /// /// Gets or sets name of the criteria. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets or sets name of the metric. /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricName")] + public string MetricName {get; set; } /// /// Gets or sets namespace of the metric. /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace {get; set; } /// - /// Gets or sets the criteria time aggregation types. Possible values - /// include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + /// Gets or sets the criteria time aggregation types. Possible values include: 'Average', 'Count', 'Minimum', 'Maximum', 'Total' /// - [JsonProperty(PropertyName = "timeAggregation")] - public string TimeAggregation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeAggregation")] + public string TimeAggregation {get; set; } /// /// Gets or sets list of dimension conditions. /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dimensions")] + public System.Collections.Generic.IList Dimensions {get; set; } /// - /// Gets or sets allows creating an alert rule on a custom metric that - /// isn't yet emitted, by causing the metric validation to be skipped. + /// Gets or sets allows creating an alert rule on a custom metric that isn't + /// yet emitted, by causing the metric validation to be skipped. /// - [JsonProperty(PropertyName = "skipMetricValidation")] - public bool? SkipMetricValidation { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "skipMetricValidation")] + public bool? SkipMetricValidation {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (MetricName == null) + if (this.MetricName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "MetricName"); } - if (TimeAggregation == null) + if (this.TimeAggregation == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "TimeAggregation"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "TimeAggregation"); } - if (Dimensions != null) + + + + + if (this.Dimensions != null) { - foreach (var element in Dimensions) + foreach (var element in this.Dimensions) { if (element != null) { @@ -139,4 +133,4 @@ public virtual void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs index cf9e86b28491..12f1ef8d25f5 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/NamespaceClassification.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for NamespaceClassification. /// + + public static class NamespaceClassification { public const string Platform = "Platform"; public const string Custom = "Custom"; public const string Qos = "Qos"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Odatatype.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Odatatype.cs new file mode 100644 index 000000000000..33b51a6930f8 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Odatatype.cs @@ -0,0 +1,20 @@ +// 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 Odatatype. + /// + + + public static class Odatatype + { + public const string MicrosoftAzureMonitorSingleResourceMultipleMetricCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"; + public const string MicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"; + public const string MicrosoftAzureMonitorWebtestLocationAvailabilityCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"; + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs index 083acf983694..af3e588a099c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationStatus.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,23 +23,33 @@ public OperationStatus() /// /// 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. + + /// 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; + this.Id = id; + this.Name = name; + this.StartTime = startTime; + this.EndTime = endTime; + this.Status = status; + this.Error = error; CustomInit(); } @@ -54,41 +58,41 @@ public OperationStatus() /// partial void CustomInit(); + /// /// Gets or sets the operation Id. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// /// Gets or sets the operation name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.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; } + [Newtonsoft.Json.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; } + [Newtonsoft.Json.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; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorResponseCommon Error {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationType.cs new file mode 100644 index 000000000000..622bfe3c4731 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperationType.cs @@ -0,0 +1,45 @@ +// 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 OperationType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum OperationType + { + [System.Runtime.Serialization.EnumMember(Value = "Scale")] + Scale + } + internal static class OperationTypeEnumExtension + { + internal static string ToSerializedValue(this OperationType? value) + { + return value == null ? null : ((OperationType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this OperationType value) + { + switch( value ) + { + case OperationType.Scale: + return "Scale"; + } + return null; + } + internal static OperationType? ParseOperationType(this string value) + { + switch( value ) + { + case "Scale": + return OperationType.Scale; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Operator.cs similarity index 77% rename from src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs rename to src/Monitor/Monitor.Management.Sdk/Generated/Models/Operator.cs index f17a6d3c7801..ad44dfc5199f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/OperatorModel.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Operator.cs @@ -1,20 +1,17 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { /// - /// Defines values for OperatorModel. + /// Defines values for Operator. /// - public static class OperatorModel + + + public static class Operator { public const string Equals = "Equals"; public const string GreaterThan = "GreaterThan"; @@ -22,4 +19,4 @@ public static class OperatorModel public const string LessThan = "LessThan"; public const string LessThanOrEqual = "LessThanOrEqual"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs index f13b6312d35f..926886048640 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page.cs @@ -1,53 +1,43 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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; /// /// Defines a page in Azure responses. /// /// Type of the page content items - [JsonObject] - public class Page : IPage + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs index 8eb5b9de7c3e..02fd87a9709a 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Page1.cs @@ -1,53 +1,43 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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; /// /// Defines a page in Azure responses. /// /// Type of the page content items - [JsonObject] - public class Page1 : IPage + [Newtonsoft.Json.JsonObject] + public class Page1 : Microsoft.Rest.Azure.IPage { - /// - /// Gets the link to the next page. - /// - [JsonProperty("")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs index 92815fd0af43..2762d7daecf4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class PrivateEndpointConnection : ProxyResource { /// @@ -32,21 +24,31 @@ public PrivateEndpointConnection() /// /// 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. + + /// 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) + + : base(id, name, type) { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; + this.PrivateEndpoint = privateEndpoint; + this.PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + this.ProvisioningState = provisioningState; CustomInit(); } @@ -55,36 +57,38 @@ public PrivateEndpointConnection() /// partial void CustomInit(); + /// /// Gets or sets private endpoint which the connection belongs to. /// - [JsonProperty(PropertyName = "properties.privateEndpoint")] - public PrivateEndpointProperty PrivateEndpoint { get; set; } + [Newtonsoft.Json.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; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (PrivateLinkServiceConnectionState != null) + + if (this.PrivateLinkServiceConnectionState != null) { - PrivateLinkServiceConnectionState.Validate(); + this.PrivateLinkServiceConnectionState.Validate(); } + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..be8fbeb89e06 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using System.Linq; + + /// + /// Properties of a private endpoint connection. + /// + public partial class PrivateEndpointConnectionProperties + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionProperties class. + /// + public PrivateEndpointConnectionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionProperties class. + /// + + /// Private endpoint which the connection belongs to. + /// + + /// Connection state of the private endpoint connection. + /// + + /// State of the private endpoint connection. + /// + public PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) + + { + this.PrivateEndpoint = privateEndpoint; + this.PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + this.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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateEndpoint")] + public PrivateEndpointProperty PrivateEndpoint {get; set; } + + /// + /// Gets or sets connection state of the private endpoint connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState {get; set; } + + /// + /// Gets state of the private endpoint connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.PrivateLinkServiceConnectionState != null) + { + this.PrivateLinkServiceConnectionState.Validate(); + } + + } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs index 58ffe77bb549..c3aa7967f210 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateEndpointProperty.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,10 +23,13 @@ public PrivateEndpointProperty() /// /// Initializes a new instance of the PrivateEndpointProperty class. /// - /// Resource id of the private endpoint. + + /// Resource id of the private endpoint. + /// public PrivateEndpointProperty(string id = default(string)) + { - Id = id; + this.Id = id; CustomInit(); } @@ -41,11 +38,11 @@ public PrivateEndpointProperty() /// partial void CustomInit(); + /// /// Gets or sets resource id of the private endpoint. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs index 7c2dae65de48..2040031154bb 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class PrivateLinkResource : ProxyResource { /// @@ -34,17 +24,27 @@ public PrivateLinkResource() /// /// 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) + + /// 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), System.Collections.Generic.IList requiredMembers = default(System.Collections.Generic.IList)) + + : base(id, name, type) { - GroupId = groupId; - RequiredMembers = requiredMembers; + this.GroupId = groupId; + this.RequiredMembers = requiredMembers; CustomInit(); } @@ -53,17 +53,17 @@ public PrivateLinkResource() /// partial void CustomInit(); + /// /// Gets the private link resource group id. /// - [JsonProperty(PropertyName = "properties.groupId")] - public string GroupId { get; private set; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.requiredMembers")] + public System.Collections.Generic.IList RequiredMembers {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..3c4a6d11ea26 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs @@ -0,0 +1,58 @@ +// 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 System.Linq; + + /// + /// Properties of a private link resource. + /// + public partial class PrivateLinkResourceProperties + { + /// + /// Initializes a new instance of the PrivateLinkResourceProperties class. + /// + public PrivateLinkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceProperties class. + /// + + /// The private link resource group id. + /// + + /// The private link resource required member names. + /// + public PrivateLinkResourceProperties(string groupId = default(string), System.Collections.Generic.IList requiredMembers = default(System.Collections.Generic.IList)) + + { + this.GroupId = groupId; + this.RequiredMembers = requiredMembers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the private link resource group id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "groupId")] + public string GroupId {get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "requiredMembers")] + public System.Collections.Generic.IList RequiredMembers {get; private set; } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs index ef895d380760..67236d48c07c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkScopesResource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 + public partial class PrivateLinkScopesResource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the PrivateLinkScopesResource class. @@ -33,18 +23,29 @@ public PrivateLinkScopesResource() /// /// 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)) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// Resource tags + /// + public PrivateLinkScopesResource(string location, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; CustomInit(); } @@ -53,48 +54,53 @@ public PrivateLinkScopesResource() /// partial void CustomInit(); + /// /// Gets azure resource Id /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets azure resource name /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets azure resource type /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// /// Gets or sets resource location /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Location == null) + if (this.Location == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs index 887acba7f23a..06d7ede6fca0 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -20,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class PrivateLinkServiceConnectionStateProperty { /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. + /// Initializes a new instance of the PrivateLinkServiceConnectionStateProperty class. /// public PrivateLinkServiceConnectionStateProperty() { @@ -29,20 +21,23 @@ public PrivateLinkServiceConnectionStateProperty() } /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. + /// 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. + + /// 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; + this.Status = status; + this.Description = description; + this.ActionsRequired = actionsRequired; CustomInit(); } @@ -51,40 +46,43 @@ public PrivateLinkServiceConnectionStateProperty() /// partial void CustomInit(); + /// /// Gets or sets the private link service connection status. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.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; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Status == null) + if (this.Status == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Status"); } - if (Description == null) + if (this.Description == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Description"); } + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs index cd2757f49843..37e010512b21 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyOnlyResource.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// /// A proxy only azure resource object /// - public partial class ProxyOnlyResource : IResource + public partial class ProxyOnlyResource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the ProxyOnlyResource class. @@ -31,14 +23,21 @@ public ProxyOnlyResource() /// /// Initializes a new instance of the ProxyOnlyResource class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// public ProxyOnlyResource(string id = default(string), string name = default(string), string type = default(string)) + { - Id = id; - Name = name; - Type = type; + this.Id = id; + this.Name = name; + this.Type = type; CustomInit(); } @@ -47,23 +46,23 @@ public ProxyOnlyResource() /// partial void CustomInit(); + /// /// Gets azure resource Id /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets azure resource name /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets azure resource type /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs index 18a5c4e49cde..5ef185813e68 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ProxyResource.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// /// An azure resource object /// - public partial class ProxyResource : IResource + public partial class ProxyResource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the ProxyResource class. @@ -31,14 +23,21 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { - Id = id; - Name = name; - Type = type; + this.Id = id; + this.Name = name; + this.Type = type; CustomInit(); } @@ -47,23 +46,23 @@ public ProxyResource() /// partial void CustomInit(); + /// /// Gets azure resource Id /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets azure resource name /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets azure resource type /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs index 040810a5ece6..afa209bcfc7c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Recurrence.cs @@ -1,22 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// - /// The repeating times at which this profile begins. This element is not - /// used if the FixedDate element is used. + /// The repeating times at which this profile begins. This element is not used + /// if the FixedDate element is used. /// public partial class Recurrence { @@ -31,19 +24,22 @@ public Recurrence() /// /// Initializes a new instance of the Recurrence class. /// - /// the recurrence frequency. How often the - /// schedule profile should take effect. This value must be Week, - /// meaning each week will have the same set of profiles. For example, - /// to set a daily schedule, set **schedule** to every day of the week. - /// The frequency property specifies that the schedule is repeated - /// weekly. Possible values include: 'None', 'Second', 'Minute', - /// 'Hour', 'Day', 'Week', 'Month', 'Year' - /// the scheduling constraints for when the - /// profile begins. + + /// the recurrence frequency. How often the schedule profile should take + /// effect. This value must be Week, meaning each week will have the same set + /// of profiles. For example, to set a daily schedule, set **schedule** to + /// every day of the week. The frequency property specifies that the schedule + /// is repeated weekly. + /// Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', + /// 'Month', 'Year' + + /// the scheduling constraints for when the profile begins. + /// public Recurrence(RecurrenceFrequency frequency, RecurrentSchedule schedule) + { - Frequency = frequency; - Schedule = schedule; + this.Frequency = frequency; + this.Schedule = schedule; CustomInit(); } @@ -52,41 +48,39 @@ public Recurrence(RecurrenceFrequency frequency, RecurrentSchedule schedule) /// partial void CustomInit(); + /// - /// Gets or sets the recurrence frequency. How often the schedule - /// profile should take effect. This value must be Week, meaning each - /// week will have the same set of profiles. For example, to set a - /// daily schedule, set **schedule** to every day of the week. The - /// frequency property specifies that the schedule is repeated weekly. - /// Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', - /// 'Week', 'Month', 'Year' + /// Gets or sets the recurrence frequency. How often the schedule profile + /// should take effect. This value must be Week, meaning each week will have + /// the same set of profiles. For example, to set a daily schedule, set + /// **schedule** to every day of the week. The frequency property specifies + /// that the schedule is repeated weekly. Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' /// - [JsonProperty(PropertyName = "frequency")] - public RecurrenceFrequency Frequency { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "frequency")] + public RecurrenceFrequency Frequency {get; set; } /// - /// Gets or sets the scheduling constraints for when the profile - /// begins. + /// Gets or sets the scheduling constraints for when the profile begins. /// - [JsonProperty(PropertyName = "schedule")] - public RecurrentSchedule Schedule { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "schedule")] + public RecurrentSchedule Schedule {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Schedule == null) + if (this.Schedule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Schedule"); } - if (Schedule != null) + + if (this.Schedule != null) { - Schedule.Validate(); + this.Schedule.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs index 27b48299752a..95b2982af5f7 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrenceFrequency.cs @@ -1,41 +1,34 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for RecurrenceFrequency. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum RecurrenceFrequency { - [EnumMember(Value = "None")] + [System.Runtime.Serialization.EnumMember(Value = "None")] None, - [EnumMember(Value = "Second")] + [System.Runtime.Serialization.EnumMember(Value = "Second")] Second, - [EnumMember(Value = "Minute")] + [System.Runtime.Serialization.EnumMember(Value = "Minute")] Minute, - [EnumMember(Value = "Hour")] + [System.Runtime.Serialization.EnumMember(Value = "Hour")] Hour, - [EnumMember(Value = "Day")] + [System.Runtime.Serialization.EnumMember(Value = "Day")] Day, - [EnumMember(Value = "Week")] + [System.Runtime.Serialization.EnumMember(Value = "Week")] Week, - [EnumMember(Value = "Month")] + [System.Runtime.Serialization.EnumMember(Value = "Month")] Month, - [EnumMember(Value = "Year")] + [System.Runtime.Serialization.EnumMember(Value = "Year")] Year } internal static class RecurrenceFrequencyEnumExtension @@ -44,7 +37,6 @@ internal static string ToSerializedValue(this RecurrenceFrequency? value) { return value == null ? null : ((RecurrenceFrequency)value).ToSerializedValue(); } - internal static string ToSerializedValue(this RecurrenceFrequency value) { switch( value ) @@ -68,7 +60,6 @@ internal static string ToSerializedValue(this RecurrenceFrequency value) } return null; } - internal static RecurrenceFrequency? ParseRecurrenceFrequency(this string value) { switch( value ) @@ -93,4 +84,4 @@ internal static string ToSerializedValue(this RecurrenceFrequency value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs index 5003472be503..24ea75c41ac3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RecurrentSchedule.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,62 +23,64 @@ public RecurrentSchedule() /// /// Initializes a new instance of the RecurrentSchedule class. /// - /// the timezone for the hours of the profile. - /// Some examples of valid time zones are: Dateline Standard Time, - /// UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - /// Standard Time (Mexico), Pacific Standard Time, US Mountain Standard - /// Time, Mountain Standard Time (Mexico), Mountain Standard Time, - /// Central America Standard Time, Central Standard Time, Central - /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific - /// Standard Time, Eastern Standard Time, US Eastern Standard Time, - /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - /// Time, Central Brazilian Standard Time, SA Western Standard Time, - /// Pacific SA Standard Time, Newfoundland Standard Time, E. South - /// America Standard Time, Argentina Standard Time, SA Eastern Standard - /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia - /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT - /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, - /// Central Europe Standard Time, Romance Standard Time, Central - /// European Standard Time, W. Central Africa Standard Time, Namibia - /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East - /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe - /// Standard Time, South Africa Standard Time, FLE Standard Time, - /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard - /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard - /// Time, Belarus Standard Time, Russian Standard Time, E. Africa - /// Standard Time, Iran Standard Time, Arabian Standard Time, - /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard - /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard - /// Time - /// the collection of days that the profile takes - /// effect on. Possible values are Sunday through Saturday. - /// A collection of hours that the profile takes - /// effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - /// times are not supported). - /// A collection of minutes at which the profile - /// takes effect at. - public RecurrentSchedule(string timeZone, IList days, IList hours, IList minutes) + + /// the timezone for the hours of the profile. Some examples of valid time + /// zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan + /// Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US + /// Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard + /// Time, Central America Standard Time, Central Standard Time, Central + /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard + /// Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard + /// Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian + /// Standard Time, SA Western Standard Time, Pacific SA Standard Time, + /// Newfoundland Standard Time, E. South America Standard Time, Argentina + /// Standard Time, SA Eastern Standard Time, Greenland Standard Time, + /// Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic + /// Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco + /// Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe + /// Standard Time, Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia Standard + /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, + /// Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South + /// Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + /// Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + /// Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + /// Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + /// West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard + /// Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, + /// Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia + /// Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia + /// Standard Time, China Standard Time, North Asia East Standard Time, + /// Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, + /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + /// Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + /// Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + /// Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + /// Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + /// Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + /// Islands Standard Time + /// + + /// the collection of days that the profile takes effect on. Possible values + /// are Sunday through Saturday. + /// + + /// A collection of hours that the profile takes effect on. Values supported + /// are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + /// + + /// A collection of minutes at which the profile takes effect at. + /// + public RecurrentSchedule(string timeZone, System.Collections.Generic.IList days, System.Collections.Generic.IList hours, System.Collections.Generic.IList minutes) + { - TimeZone = timeZone; - Days = days; - Hours = hours; - Minutes = minutes; + this.TimeZone = timeZone; + this.Days = days; + this.Hours = hours; + this.Minutes = minutes; CustomInit(); } @@ -96,99 +89,97 @@ public RecurrentSchedule(string timeZone, IList days, IList hours, /// partial void CustomInit(); + /// - /// Gets or sets the timezone for the hours of the profile. Some - /// examples of valid time zones are: Dateline Standard Time, UTC-11, - /// Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - /// Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - /// Mountain Standard Time (Mexico), Mountain Standard Time, Central - /// America Standard Time, Central Standard Time, Central Standard Time - /// (Mexico), Canada Central Standard Time, SA Pacific Standard Time, - /// Eastern Standard Time, US Eastern Standard Time, Venezuela Standard - /// Time, Paraguay Standard Time, Atlantic Standard Time, Central - /// Brazilian Standard Time, SA Western Standard Time, Pacific SA - /// Standard Time, Newfoundland Standard Time, E. South America - /// Standard Time, Argentina Standard Time, SA Eastern Standard Time, - /// Greenland Standard Time, Montevideo Standard Time, Bahia Standard - /// Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, - /// Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard - /// Time, Greenwich Standard Time, W. Europe Standard Time, Central - /// Europe Standard Time, Romance Standard Time, Central European - /// Standard Time, W. Central Africa Standard Time, Namibia Standard - /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - /// Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard - /// Time, South Africa Standard Time, FLE Standard Time, Turkey - /// Standard Time, Israel Standard Time, Kaliningrad Standard Time, - /// Libya Standard Time, Arabic Standard Time, Arab Standard Time, - /// Belarus Standard Time, Russian Standard Time, E. Africa Standard - /// Time, Iran Standard Time, Arabian Standard Time, Azerbaijan - /// Standard Time, Russia Time Zone 3, Mauritius Standard Time, - /// Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard Time + /// Gets or sets the timezone for the hours of the profile. Some examples of + /// valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard + /// Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific + /// Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), + /// Mountain Standard Time, Central America Standard Time, Central Standard + /// Time, Central Standard Time (Mexico), Canada Central Standard Time, SA + /// Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, + /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, + /// Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + /// Standard Time, Newfoundland Standard Time, E. South America Standard Time, + /// Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, + /// Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic + /// Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco + /// Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe + /// Standard Time, Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia Standard + /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, + /// Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South + /// Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + /// Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + /// Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + /// Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + /// West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard + /// Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, + /// Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia + /// Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia + /// Standard Time, China Standard Time, North Asia East Standard Time, + /// Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, + /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + /// Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + /// Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + /// Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + /// Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + /// Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + /// Islands Standard Time /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZone")] + public string TimeZone {get; set; } /// - /// Gets or sets the collection of days that the profile takes effect - /// on. Possible values are Sunday through Saturday. + /// Gets or sets the collection of days that the profile takes effect on. + /// Possible values are Sunday through Saturday. /// - [JsonProperty(PropertyName = "days")] - public IList Days { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "days")] + public System.Collections.Generic.IList Days {get; set; } /// - /// Gets or sets a collection of hours that the profile takes effect - /// on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times - /// are not supported). + /// Gets or sets a collection of hours that the profile takes effect on. Values + /// supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). /// - [JsonProperty(PropertyName = "hours")] - public IList Hours { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "hours")] + public System.Collections.Generic.IList Hours {get; set; } /// - /// Gets or sets a collection of minutes at which the profile takes - /// effect at. + /// Gets or sets a collection of minutes at which the profile takes effect at. /// - [JsonProperty(PropertyName = "minutes")] - public IList Minutes { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "minutes")] + public System.Collections.Generic.IList Minutes {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (TimeZone == null) + if (this.TimeZone == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "TimeZone"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "TimeZone"); } - if (Days == null) + if (this.Days == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Days"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Days"); } - if (Hours == null) + if (this.Hours == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Hours"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Hours"); } - if (Minutes == null) + if (this.Minutes == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Minutes"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Minutes"); } + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs index d3ccce82751b..a5a96eaaa5e7 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Resource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 Resource : IResource + public partial class Resource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the Resource class. @@ -33,18 +23,29 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + + /// Azure resource Id + /// + + /// Azure resource name + /// + + /// Azure resource type + /// + + /// Resource location + /// + + /// Resource tags + /// + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; CustomInit(); } @@ -53,48 +54,53 @@ public Resource() /// partial void CustomInit(); + /// /// Gets azure resource Id /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets azure resource name /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets azure resource type /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// /// Gets or sets resource location /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Location == null) + if (this.Location == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs index 828d2ec23b0d..ab95e15d67d4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/Response.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,29 +23,37 @@ public Response() /// /// Initializes a new instance of the Response class. /// - /// The timespan for which the data was - /// retrieved. Its value consists of two datetimes concatenated, - /// separated by '/'. This may be adjusted in the future and returned - /// back from what was originally requested. - /// the value of the collection. - /// The integer value representing the relative cost - /// of the query. - /// The interval (window size) for which the - /// metric data was returned in. This may be adjusted in the future - /// and returned back from what was originally requested. This is not - /// present if a metadata request was made. - /// The namespace of the metrics being - /// queried - /// The region of the resource being - /// queried for metrics. - public Response(string timespan, IList value, double? cost = default(double?), System.TimeSpan? interval = default(System.TimeSpan?), string namespaceProperty = default(string), string resourceregion = default(string)) + + /// The integer value representing the relative cost of the query. + /// + + /// The timespan for which the data was retrieved. Its value consists of two + /// datetimes concatenated, separated by '/'. This may be adjusted in the + /// future and returned back from what was originally requested. + /// + + /// The interval (window size) for which the metric data was returned in. This + /// may be adjusted in the future and returned back from what was originally + /// requested. This is not present if a metadata request was made. + /// + + /// The namespace of the metrics being queried + /// + + /// The region of the resource being queried for metrics. + /// + + /// the value of the collection. + /// + public Response(string timespan, System.Collections.Generic.IList value, int? cost = default(int?), System.TimeSpan? interval = default(System.TimeSpan?), string namespaceProperty = default(string), string resourceregion = default(string)) + { - Cost = cost; - Timespan = timespan; - Interval = interval; - NamespaceProperty = namespaceProperty; - Resourceregion = resourceregion; - Value = value; + this.Cost = cost; + this.Timespan = timespan; + this.Interval = interval; + this.NamespaceProperty = namespaceProperty; + this.Resourceregion = resourceregion; + this.Value = value; CustomInit(); } @@ -63,75 +62,77 @@ public Response() /// partial void CustomInit(); + /// - /// Gets or sets the integer value representing the relative cost of - /// the query. + /// Gets or sets the integer value representing the relative cost of the query. /// - [JsonProperty(PropertyName = "cost")] - public double? Cost { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "cost")] + public int? Cost {get; set; } /// - /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datetimes concatenated, separated by '/'. - /// This may be adjusted in the future and returned back from what was - /// originally requested. + /// Gets or sets the timespan for which the data was retrieved. Its value + /// consists of two datetimes concatenated, separated by '/'. This may be + /// adjusted in the future and returned back from what was originally + /// requested. /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timespan")] + public string Timespan {get; set; } /// - /// Gets or sets the interval (window size) for which the metric data - /// was returned in. This may be adjusted in the future and returned - /// back from what was originally requested. This is not present if a - /// metadata request was made. + /// Gets or sets the interval (window size) for which the metric data was + /// returned in. This may be adjusted in the future and returned back from + /// what was originally requested. This is not present if a metadata request + /// was made. /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "interval")] + public System.TimeSpan? Interval {get; set; } /// /// Gets or sets the namespace of the metrics being queried /// - [JsonProperty(PropertyName = "namespace")] - public string NamespaceProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty {get; set; } /// /// Gets or sets the region of the resource being queried for metrics. /// - [JsonProperty(PropertyName = "resourceregion")] - public string Resourceregion { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceregion")] + public string Resourceregion {get; set; } /// /// Gets or sets the value of the collection. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Timespan == null) + if (this.Timespan == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Timespan"); } - if (Value == null) + if (this.Value == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); } - if (Cost != null) + if (this.Cost != null) { - if (Cost < 0) + if (this.Cost < 0) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Cost", 0); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "Cost", 0); } } - if (Value != null) + + + + if (this.Value != null) { - foreach (var element in Value) + foreach (var element in this.Value) { if (element != null) { @@ -141,4 +142,4 @@ public virtual void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs index d0133162a521..acbe1be0c2a1 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ResultType.cs @@ -1,29 +1,22 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for ResultType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ResultType { - [EnumMember(Value = "Data")] + [System.Runtime.Serialization.EnumMember(Value = "Data")] Data, - [EnumMember(Value = "Metadata")] + [System.Runtime.Serialization.EnumMember(Value = "Metadata")] Metadata } internal static class ResultTypeEnumExtension @@ -32,7 +25,6 @@ internal static string ToSerializedValue(this ResultType? value) { return value == null ? null : ((ResultType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this ResultType value) { switch( value ) @@ -44,7 +36,6 @@ internal static string ToSerializedValue(this ResultType value) } return null; } - internal static ResultType? ParseResultType(this string value) { switch( value ) @@ -57,4 +48,4 @@ internal static string ToSerializedValue(this ResultType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs index 683b0b6aa07a..01a1cc4800a3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RetentionPolicy.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,14 +23,18 @@ public RetentionPolicy() /// /// Initializes a new instance of the RetentionPolicy class. /// - /// a value indicating whether the retention - /// policy is enabled. - /// the number of days for the retention in days. A - /// value of 0 will retain the events indefinitely. + + /// a value indicating whether the retention policy is enabled. + /// + + /// the number of days for the retention in days. A value of 0 will retain the + /// events indefinitely. + /// public RetentionPolicy(bool enabled, int days) + { - Enabled = enabled; - Days = days; + this.Enabled = enabled; + this.Days = days; CustomInit(); } @@ -46,32 +43,31 @@ public RetentionPolicy(bool enabled, int days) /// partial void CustomInit(); + /// - /// Gets or sets a value indicating whether the retention policy is - /// enabled. + /// Gets or sets a value indicating whether the retention policy is enabled. /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool Enabled {get; set; } /// - /// Gets or sets the number of days for the retention in days. A value - /// of 0 will retain the events indefinitely. + /// Gets or sets the number of days for the retention in days. A value of 0 + /// will retain the events indefinitely. /// - [JsonProperty(PropertyName = "days")] - public int Days { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "days")] + public int Days {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Days < 0) + if (this.Days < 0) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Days", 0); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "Days", 0); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs index 477a7bd77c29..70fa522929f9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleAction.cs @@ -1,21 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 action that is performed when the alert rule becomes active, and - /// when an alert condition is resolved. + /// The action that is performed when the alert rule becomes active, and when + /// an alert condition is resolved. /// [Newtonsoft.Json.JsonObject("RuleAction")] public partial class RuleAction @@ -35,4 +29,4 @@ public RuleAction() partial void CustomInit(); } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs index 4a1d4ec4aa1f..d734416fa137 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleCondition.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,12 +24,14 @@ public RuleCondition() /// /// Initializes a new instance of the RuleCondition class. /// - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. + + /// the resource from which the rule collects its data. For this type + /// dataSource will always be of type RuleMetricDataSource. + /// public RuleCondition(RuleDataSource dataSource = default(RuleDataSource)) + { - DataSource = dataSource; + this.DataSource = dataSource; CustomInit(); } @@ -44,13 +40,12 @@ public RuleCondition() /// partial void CustomInit(); + /// - /// Gets or sets the resource from which the rule collects its data. - /// For this type dataSource will always be of type - /// RuleMetricDataSource. + /// Gets or sets the resource from which the rule collects its data. For this + /// type dataSource will always be of type RuleMetricDataSource. /// - [JsonProperty(PropertyName = "dataSource")] - public RuleDataSource DataSource { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "dataSource")] + public RuleDataSource DataSource {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs index 70b74b15f0fb..8b3917de9d51 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleDataSource.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,21 +24,27 @@ public RuleDataSource() /// /// Initializes a new instance of the RuleDataSource class. /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - /// the legacy resource identifier of - /// the resource the rule monitors. **NOTE**: this property cannot be - /// updated for an existing rule. - /// the location of the - /// resource. - /// the namespace of the metric. + + /// the resource identifier of the resource the rule monitors. **NOTE**: this + /// property cannot be updated for an existing rule. + /// + + /// the legacy resource identifier of the resource the rule monitors. **NOTE**: + /// this property cannot be updated for an existing rule. + /// + + /// the location of the resource. + /// + + /// the namespace of the metric. + /// public RuleDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string)) + { - ResourceUri = resourceUri; - LegacyResourceId = legacyResourceId; - ResourceLocation = resourceLocation; - MetricNamespace = metricNamespace; + this.ResourceUri = resourceUri; + this.LegacyResourceId = legacyResourceId; + this.ResourceLocation = resourceLocation; + this.MetricNamespace = metricNamespace; CustomInit(); } @@ -53,33 +53,31 @@ public RuleDataSource() /// partial void CustomInit(); + /// - /// Gets or sets the resource identifier of the resource the rule - /// monitors. **NOTE**: this property cannot be updated for an existing - /// rule. + /// Gets or sets the resource identifier of the resource the rule monitors. + /// **NOTE**: this property cannot be updated for an existing rule. /// - [JsonProperty(PropertyName = "resourceUri")] - public string ResourceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri {get; set; } /// - /// Gets or sets the legacy resource identifier of the resource the - /// rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. + /// Gets or sets the legacy resource identifier of the resource the rule + /// monitors. **NOTE**: this property cannot be updated for an existing rule. /// - [JsonProperty(PropertyName = "legacyResourceId")] - public string LegacyResourceId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "legacyResourceId")] + public string LegacyResourceId {get; set; } /// /// Gets or sets the location of the resource. /// - [JsonProperty(PropertyName = "resourceLocation")] - public string ResourceLocation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceLocation")] + public string ResourceLocation {get; set; } /// /// Gets or sets the namespace of the metric. /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs index 5c8972fa6dec..6d2afe414114 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleEmailAction.cs @@ -1,23 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// - /// Specifies the action to send email when the rule condition is - /// evaluated. The discriminator is always RuleEmailAction in this case. + /// Specifies the action to send email when the rule condition is evaluated. + /// The discriminator is always RuleEmailAction in this case. /// [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleEmailAction")] public partial class RuleEmailAction : RuleAction @@ -33,15 +25,19 @@ public RuleEmailAction() /// /// Initializes a new instance of the RuleEmailAction class. /// - /// Whether the administrators - /// (service and co-administrators) of the service should be notified - /// when the alert is activated. - /// the list of administrator's custom email - /// addresses to notify of the activation of the alert. - public RuleEmailAction(bool? sendToServiceOwners = default(bool?), IList customEmails = default(IList)) + + /// Whether the administrators (service and co-administrators) of the service + /// should be notified when the alert is activated. + /// + + /// the list of administrator's custom email addresses to notify of the + /// activation of the alert. + /// + public RuleEmailAction(bool? sendToServiceOwners = default(bool?), System.Collections.Generic.IList customEmails = default(System.Collections.Generic.IList)) + { - SendToServiceOwners = sendToServiceOwners; - CustomEmails = customEmails; + this.SendToServiceOwners = sendToServiceOwners; + this.CustomEmails = customEmails; CustomInit(); } @@ -50,20 +46,19 @@ public RuleEmailAction() /// partial void CustomInit(); + /// - /// Gets or sets whether the administrators (service and - /// co-administrators) of the service should be notified when the alert - /// is activated. + /// Gets or sets whether the administrators (service and co-administrators) of + /// the service should be notified when the alert is activated. /// - [JsonProperty(PropertyName = "sendToServiceOwners")] - public bool? SendToServiceOwners { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sendToServiceOwners")] + public bool? SendToServiceOwners {get; set; } /// - /// Gets or sets the list of administrator's custom email addresses to - /// notify of the activation of the alert. + /// Gets or sets the list of administrator's custom email addresses to notify + /// of the activation of the alert. /// - [JsonProperty(PropertyName = "customEmails")] - public IList CustomEmails { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "customEmails")] + public System.Collections.Generic.IList CustomEmails {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs index d2acb8d1268c..75dec4995c35 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventClaimsDataSource.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class RuleManagementEventClaimsDataSource { /// - /// Initializes a new instance of the - /// RuleManagementEventClaimsDataSource class. + /// Initializes a new instance of the RuleManagementEventClaimsDataSource class. /// public RuleManagementEventClaimsDataSource() { @@ -28,13 +21,15 @@ public RuleManagementEventClaimsDataSource() } /// - /// Initializes a new instance of the - /// RuleManagementEventClaimsDataSource class. + /// Initializes a new instance of the RuleManagementEventClaimsDataSource class. /// - /// the email address. + + /// the email address. + /// public RuleManagementEventClaimsDataSource(string emailAddress = default(string)) + { - EmailAddress = emailAddress; + this.EmailAddress = emailAddress; CustomInit(); } @@ -43,11 +38,11 @@ public RuleManagementEventClaimsDataSource() /// partial void CustomInit(); + /// /// Gets or sets the email address. /// - [JsonProperty(PropertyName = "emailAddress")] - public string EmailAddress { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "emailAddress")] + public string EmailAddress {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs index 8c50bf453300..91ce3943b09d 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleManagementEventDataSource.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -21,8 +15,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class RuleManagementEventDataSource : RuleDataSource { /// - /// Initializes a new instance of the RuleManagementEventDataSource - /// class. + /// Initializes a new instance of the RuleManagementEventDataSource class. /// public RuleManagementEventDataSource() { @@ -30,44 +23,64 @@ public RuleManagementEventDataSource() } /// - /// Initializes a new instance of the RuleManagementEventDataSource - /// class. + /// Initializes a new instance of the RuleManagementEventDataSource class. /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - /// the legacy resource identifier of - /// the resource the rule monitors. **NOTE**: this property cannot be - /// updated for an existing rule. - /// the location of the - /// resource. - /// the namespace of the metric. - /// the event name. - /// the event source. - /// the level. - /// The name of the operation that should - /// be checked for. If no name is provided, any operation will - /// match. - /// the resource group name. - /// the resource provider - /// name. - /// The status of the operation that should be - /// checked for. If no status is provided, any status will - /// match. - /// the substatus. - /// the claims. + + /// the resource identifier of the resource the rule monitors. **NOTE**: this + /// property cannot be updated for an existing rule. + /// + + /// the legacy resource identifier of the resource the rule monitors. **NOTE**: + /// this property cannot be updated for an existing rule. + /// + + /// the location of the resource. + /// + + /// the namespace of the metric. + /// + + /// the event name. + /// + + /// the event source. + /// + + /// the level. + /// + + /// The name of the operation that should be checked for. If no name is + /// provided, any operation will match. + /// + + /// the resource group name. + /// + + /// the resource provider name. + /// + + /// The status of the operation that should be checked for. If no status is + /// provided, any status will match. + /// + + /// the substatus. + /// + + /// the claims. + /// public RuleManagementEventDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string), string eventName = default(string), string eventSource = default(string), string level = default(string), string operationName = default(string), string resourceGroupName = default(string), string resourceProviderName = default(string), string status = default(string), string subStatus = default(string), RuleManagementEventClaimsDataSource claims = default(RuleManagementEventClaimsDataSource)) - : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) + + : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) { - EventName = eventName; - EventSource = eventSource; - Level = level; - OperationName = operationName; - ResourceGroupName = resourceGroupName; - ResourceProviderName = resourceProviderName; - Status = status; - SubStatus = subStatus; - Claims = claims; + this.EventName = eventName; + this.EventSource = eventSource; + this.Level = level; + this.OperationName = operationName; + this.ResourceGroupName = resourceGroupName; + this.ResourceProviderName = resourceProviderName; + this.Status = status; + this.SubStatus = subStatus; + this.Claims = claims; CustomInit(); } @@ -76,61 +89,61 @@ public RuleManagementEventDataSource() /// partial void CustomInit(); + /// /// Gets or sets the event name. /// - [JsonProperty(PropertyName = "eventName")] - public string EventName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } /// /// Gets or sets the event source. /// - [JsonProperty(PropertyName = "eventSource")] - public string EventSource { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "eventSource")] + public string EventSource {get; set; } /// /// Gets or sets the level. /// - [JsonProperty(PropertyName = "level")] - public string Level { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "level")] + public string Level {get; set; } /// - /// Gets or sets the name of the operation that should be checked for. - /// If no name is provided, any operation will match. + /// Gets or sets the name of the operation that should be checked for. If no + /// name is provided, any operation will match. /// - [JsonProperty(PropertyName = "operationName")] - public string OperationName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operationName")] + public string OperationName {get; set; } /// /// Gets or sets the resource group name. /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName {get; set; } /// /// Gets or sets the resource provider name. /// - [JsonProperty(PropertyName = "resourceProviderName")] - public string ResourceProviderName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceProviderName")] + public string ResourceProviderName {get; set; } /// - /// Gets or sets the status of the operation that should be checked - /// for. If no status is provided, any status will match. + /// Gets or sets the status of the operation that should be checked for. If no + /// status is provided, any status will match. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets the substatus. /// - [JsonProperty(PropertyName = "subStatus")] - public string SubStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subStatus")] + public string SubStatus {get; set; } /// /// Gets or sets the claims. /// - [JsonProperty(PropertyName = "claims")] - public RuleManagementEventClaimsDataSource Claims { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "claims")] + public RuleManagementEventClaimsDataSource Claims {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs index 7b650acc4bff..c49487c28bb3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleMetricDataSource.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,21 +25,28 @@ public RuleMetricDataSource() /// /// Initializes a new instance of the RuleMetricDataSource class. /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - /// the legacy resource identifier of - /// the resource the rule monitors. **NOTE**: this property cannot be - /// updated for an existing rule. - /// the location of the - /// resource. - /// the namespace of the metric. - /// the name of the metric that defines what - /// the rule monitors. + + /// the resource identifier of the resource the rule monitors. **NOTE**: this + /// property cannot be updated for an existing rule. + /// + + /// the legacy resource identifier of the resource the rule monitors. **NOTE**: + /// this property cannot be updated for an existing rule. + /// + + /// the location of the resource. + /// + + /// the namespace of the metric. + /// + + /// the name of the metric that defines what the rule monitors. + /// public RuleMetricDataSource(string resourceUri = default(string), string legacyResourceId = default(string), string resourceLocation = default(string), string metricNamespace = default(string), string metricName = default(string)) - : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) + + : base(resourceUri, legacyResourceId, resourceLocation, metricNamespace) { - MetricName = metricName; + this.MetricName = metricName; CustomInit(); } @@ -54,12 +55,11 @@ public RuleMetricDataSource() /// partial void CustomInit(); + /// - /// Gets or sets the name of the metric that defines what the rule - /// monitors. + /// Gets or sets the name of the metric that defines what the rule monitors. /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "metricName")] + public string MetricName {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs index b70d12e5444b..5a4bc765d068 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/RuleWebhookAction.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -33,15 +25,19 @@ public RuleWebhookAction() /// /// Initializes a new instance of the RuleWebhookAction class. /// - /// the service uri to Post the notification - /// when the alert activates or resolves. - /// the dictionary of custom properties to - /// include with the post operation. These data are appended to the - /// webhook payload. - public RuleWebhookAction(string serviceUri = default(string), IDictionary properties = default(IDictionary)) + + /// the service uri to Post the notification when the alert activates or + /// resolves. + /// + + /// the dictionary of custom properties to include with the post operation. + /// These data are appended to the webhook payload. + /// + public RuleWebhookAction(string serviceUri = default(string), System.Collections.Generic.IDictionary properties = default(System.Collections.Generic.IDictionary)) + { - ServiceUri = serviceUri; - Properties = properties; + this.ServiceUri = serviceUri; + this.Properties = properties; CustomInit(); } @@ -50,19 +46,19 @@ public RuleWebhookAction() /// partial void CustomInit(); + /// - /// Gets or sets the service uri to Post the notification when the - /// alert activates or resolves. + /// Gets or sets the service uri to Post the notification when the alert + /// activates or resolves. /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "serviceUri")] + public string ServiceUri {get; set; } /// - /// Gets or sets the dictionary of custom properties to include with - /// the post operation. These data are appended to the webhook payload. + /// Gets or sets the dictionary of custom properties to include with the post + /// operation. These data are appended to the webhook payload. /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public System.Collections.Generic.IDictionary Properties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs index 9f23316376c8..7e5c41aabbed 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleAction.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,25 +23,29 @@ public ScaleAction() /// /// Initializes a new instance of the ScaleAction class. /// - /// the scale direction. Whether the scaling - /// action increases or decreases the number of instances. Possible - /// values include: 'None', 'Increase', 'Decrease' - /// the type of action that should occur when the - /// scale rule fires. Possible values include: 'ChangeCount', - /// 'PercentChangeCount', 'ExactCount', - /// 'ServiceAllowedNextValue' - /// the amount of time to wait since the last - /// scaling action before this action occurs. It must be between 1 week - /// and 1 minute in ISO 8601 format. - /// the number of instances that are involved in - /// the scaling action. This value must be 1 or greater. The default - /// value is 1. + + /// the scale direction. Whether the scaling action increases or decreases the + /// number of instances. + /// Possible values include: 'None', 'Increase', 'Decrease' + + /// the type of action that should occur when the scale rule fires. + /// Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', + /// 'ServiceAllowedNextValue' + + /// the number of instances that are involved in the scaling action. This value + /// must be 1 or greater. The default value is 1. + /// + + /// the amount of time to wait since the last scaling action before this action + /// occurs. It must be between 1 week and 1 minute in ISO 8601 format. + /// public ScaleAction(ScaleDirection direction, ScaleType type, System.TimeSpan cooldown, string value = default(string)) + { - Direction = direction; - Type = type; - Value = value; - Cooldown = cooldown; + this.Direction = direction; + this.Type = type; + this.Value = value; + this.Cooldown = cooldown; CustomInit(); } @@ -56,46 +54,46 @@ public ScaleAction() /// partial void CustomInit(); + /// - /// Gets or sets the scale direction. Whether the scaling action - /// increases or decreases the number of instances. Possible values - /// include: 'None', 'Increase', 'Decrease' + /// Gets or sets the scale direction. Whether the scaling action increases or + /// decreases the number of instances. Possible values include: 'None', 'Increase', 'Decrease' /// - [JsonProperty(PropertyName = "direction")] - public ScaleDirection Direction { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "direction")] + public ScaleDirection Direction {get; set; } /// - /// Gets or sets the type of action that should occur when the scale - /// rule fires. Possible values include: 'ChangeCount', - /// 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' + /// Gets or sets the type of action that should occur when the scale rule + /// fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount', 'ServiceAllowedNextValue' /// - [JsonProperty(PropertyName = "type")] - public ScaleType Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public ScaleType Type {get; set; } /// - /// Gets or sets the number of instances that are involved in the - /// scaling action. This value must be 1 or greater. The default value - /// is 1. + /// Gets or sets the number of instances that are involved in the scaling + /// action. This value must be 1 or greater. The default value is 1. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } /// - /// Gets or sets the amount of time to wait since the last scaling - /// action before this action occurs. It must be between 1 week and 1 - /// minute in ISO 8601 format. + /// Gets or sets the amount of time to wait since the last scaling action + /// before this action occurs. It must be between 1 week and 1 minute in ISO + /// 8601 format. /// - [JsonProperty(PropertyName = "cooldown")] - public System.TimeSpan Cooldown { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "cooldown")] + public System.TimeSpan Cooldown {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs index 755f92253b1f..91180a3e25d9 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleCapacity.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,20 +23,25 @@ public ScaleCapacity() /// /// Initializes a new instance of the ScaleCapacity class. /// - /// the minimum number of instances for the - /// resource. - /// the maximum number of instances for the - /// resource. The actual maximum number of instances is limited by the - /// cores that are available in the subscription. - /// the number of instances that will be - /// set if metrics are not available for evaluation. The default is - /// only used if the current instance count is lower than the - /// default. + + /// the minimum number of instances for the resource. + /// + + /// the maximum number of instances for the resource. The actual maximum number + /// of instances is limited by the cores that are available in the + /// subscription. + /// + + /// the number of instances that will be set if metrics are not available for + /// evaluation. The default is only used if the current instance count is lower + /// than the default. + /// public ScaleCapacity(string minimum, string maximum, string defaultProperty) + { - Minimum = minimum; - Maximum = maximum; - DefaultProperty = defaultProperty; + this.Minimum = minimum; + this.Maximum = maximum; + this.DefaultProperty = defaultProperty; CustomInit(); } @@ -52,48 +50,51 @@ public ScaleCapacity(string minimum, string maximum, string defaultProperty) /// partial void CustomInit(); + /// /// Gets or sets the minimum number of instances for the resource. /// - [JsonProperty(PropertyName = "minimum")] - public string Minimum { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "minimum")] + public string Minimum {get; set; } /// - /// Gets or sets the maximum number of instances for the resource. The - /// actual maximum number of instances is limited by the cores that are - /// available in the subscription. + /// Gets or sets the maximum number of instances for the resource. The actual + /// maximum number of instances is limited by the cores that are available in + /// the subscription. /// - [JsonProperty(PropertyName = "maximum")] - public string Maximum { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "maximum")] + public string Maximum {get; set; } /// - /// Gets or sets the number of instances that will be set if metrics - /// are not available for evaluation. The default is only used if the - /// current instance count is lower than the default. + /// Gets or sets the number of instances that will be set if metrics are not + /// available for evaluation. The default is only used if the current instance + /// count is lower than the default. /// - [JsonProperty(PropertyName = "default")] - public string DefaultProperty { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "default")] + public string DefaultProperty {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Minimum == null) + if (this.Minimum == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Minimum"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Minimum"); } - if (Maximum == null) + if (this.Maximum == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Maximum"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Maximum"); } - if (DefaultProperty == null) + if (this.DefaultProperty == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "DefaultProperty"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DefaultProperty"); } + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs index 858c37739fdb..f8c82407b8b7 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleDirection.cs @@ -1,31 +1,24 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for ScaleDirection. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ScaleDirection { - [EnumMember(Value = "None")] + [System.Runtime.Serialization.EnumMember(Value = "None")] None, - [EnumMember(Value = "Increase")] + [System.Runtime.Serialization.EnumMember(Value = "Increase")] Increase, - [EnumMember(Value = "Decrease")] + [System.Runtime.Serialization.EnumMember(Value = "Decrease")] Decrease } internal static class ScaleDirectionEnumExtension @@ -34,7 +27,6 @@ internal static string ToSerializedValue(this ScaleDirection? value) { return value == null ? null : ((ScaleDirection)value).ToSerializedValue(); } - internal static string ToSerializedValue(this ScaleDirection value) { switch( value ) @@ -48,7 +40,6 @@ internal static string ToSerializedValue(this ScaleDirection value) } return null; } - internal static ScaleDirection? ParseScaleDirection(this string value) { switch( value ) @@ -63,4 +54,4 @@ internal static string ToSerializedValue(this ScaleDirection value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs index 2f061a1523d5..261287ebb67f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRule.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,14 +23,17 @@ public ScaleRule() /// /// Initializes a new instance of the ScaleRule class. /// - /// the trigger that results in a scaling - /// action. - /// the parameters for the scaling - /// action. + + /// the trigger that results in a scaling action. + /// + + /// the parameters for the scaling action. + /// public ScaleRule(MetricTrigger metricTrigger, ScaleAction scaleAction) + { - MetricTrigger = metricTrigger; - ScaleAction = scaleAction; + this.MetricTrigger = metricTrigger; + this.ScaleAction = scaleAction; CustomInit(); } @@ -46,42 +42,42 @@ public ScaleRule(MetricTrigger metricTrigger, ScaleAction scaleAction) /// partial void CustomInit(); + /// /// Gets or sets the trigger that results in a scaling action. /// - [JsonProperty(PropertyName = "metricTrigger")] - public MetricTrigger MetricTrigger { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metricTrigger")] + public MetricTrigger MetricTrigger {get; set; } /// /// Gets or sets the parameters for the scaling action. /// - [JsonProperty(PropertyName = "scaleAction")] - public ScaleAction ScaleAction { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "scaleAction")] + public ScaleAction ScaleAction {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (MetricTrigger == null) + if (this.MetricTrigger == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricTrigger"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "MetricTrigger"); } - if (ScaleAction == null) + if (this.ScaleAction == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ScaleAction"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ScaleAction"); } - if (MetricTrigger != null) + if (this.MetricTrigger != null) { - MetricTrigger.Validate(); + this.MetricTrigger.Validate(); } - if (ScaleAction != null) + if (this.ScaleAction != null) { - ScaleAction.Validate(); + this.ScaleAction.Validate(); } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs index 9cb036d6fed2..1a83cb79ac79 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimension.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,18 +23,23 @@ public ScaleRuleMetricDimension() /// /// Initializes a new instance of the ScaleRuleMetricDimension class. /// - /// Name of the dimension. - /// the dimension operator. Only - /// 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any - /// of the values. 'NotEquals' being not equal to all of the values. - /// Possible values include: 'Equals', 'NotEquals' - /// list of dimension values. For example: - /// ["App1","App2"]. - public ScaleRuleMetricDimension(string dimensionName, string operatorProperty, IList values) + + /// Name of the dimension. + /// + + /// the dimension operator. Only 'Equals' and 'NotEquals' are supported. + /// 'Equals' being equal to any of the values. 'NotEquals' being not equal to + /// all of the values + /// Possible values include: 'Equals', 'NotEquals' + + /// list of dimension values. For example: ["App1","App2"]. + /// + public ScaleRuleMetricDimension(string dimensionName, string operatorProperty, System.Collections.Generic.IList values) + { - DimensionName = dimensionName; - OperatorProperty = operatorProperty; - Values = values; + this.DimensionName = dimensionName; + this.OperatorProperty = operatorProperty; + this.Values = values; CustomInit(); } @@ -52,48 +48,49 @@ public ScaleRuleMetricDimension(string dimensionName, string operatorProperty, I /// partial void CustomInit(); + /// /// Gets or sets name of the dimension. /// - [JsonProperty(PropertyName = "DimensionName")] - public string DimensionName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "DimensionName")] + public string DimensionName {get; set; } /// - /// Gets or sets the dimension operator. Only 'Equals' and 'NotEquals' - /// are supported. 'Equals' being equal to any of the values. - /// 'NotEquals' being not equal to all of the values. Possible values - /// include: 'Equals', 'NotEquals' + /// Gets or sets the dimension operator. Only 'Equals' and 'NotEquals' are + /// supported. 'Equals' being equal to any of the values. 'NotEquals' being not + /// equal to all of the values Possible values include: 'Equals', 'NotEquals' /// - [JsonProperty(PropertyName = "Operator")] - public string OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Operator")] + public string OperatorProperty {get; set; } /// - /// Gets or sets list of dimension values. For example: - /// ["App1","App2"]. + /// Gets or sets list of dimension values. For example: ["App1","App2"]. /// - [JsonProperty(PropertyName = "Values")] - public IList Values { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Values")] + public System.Collections.Generic.IList Values {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (DimensionName == null) + if (this.DimensionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "DimensionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DimensionName"); } - if (OperatorProperty == null) + if (this.OperatorProperty == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OperatorProperty"); } - if (Values == null) + if (this.Values == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Values"); } + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs index 3ff0455f3c4e..c8234b3f5589 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleRuleMetricDimensionOperationType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// Defines values for ScaleRuleMetricDimensionOperationType. /// + + public static class ScaleRuleMetricDimensionOperationType { public const string Equals = "Equals"; public const string NotEquals = "NotEquals"; } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs index de3dbf23de2f..409f5d674357 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScaleType.cs @@ -1,33 +1,26 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for ScaleType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum ScaleType { - [EnumMember(Value = "ChangeCount")] + [System.Runtime.Serialization.EnumMember(Value = "ChangeCount")] ChangeCount, - [EnumMember(Value = "PercentChangeCount")] + [System.Runtime.Serialization.EnumMember(Value = "PercentChangeCount")] PercentChangeCount, - [EnumMember(Value = "ExactCount")] + [System.Runtime.Serialization.EnumMember(Value = "ExactCount")] ExactCount, - [EnumMember(Value = "ServiceAllowedNextValue")] + [System.Runtime.Serialization.EnumMember(Value = "ServiceAllowedNextValue")] ServiceAllowedNextValue } internal static class ScaleTypeEnumExtension @@ -36,7 +29,6 @@ internal static string ToSerializedValue(this ScaleType? value) { return value == null ? null : ((ScaleType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this ScaleType value) { switch( value ) @@ -52,7 +44,6 @@ internal static string ToSerializedValue(this ScaleType value) } return null; } - internal static ScaleType? ParseScaleType(this string value) { switch( value ) @@ -69,4 +60,4 @@ internal static string ToSerializedValue(this ScaleType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs index bbfe8c1a2fad..decdffe3fa22 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResource.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class ScopedResource : ProxyResource { /// @@ -32,18 +24,27 @@ public ScopedResource() /// /// 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. + + /// 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) + + : base(id, name, type) { - LinkedResourceId = linkedResourceId; - ProvisioningState = provisioningState; + this.LinkedResourceId = linkedResourceId; + this.ProvisioningState = provisioningState; CustomInit(); } @@ -52,17 +53,17 @@ public ScopedResource() /// partial void CustomInit(); + /// /// Gets or sets the resource id of the scoped Azure monitor resource. /// - [JsonProperty(PropertyName = "properties.linkedResourceId")] - public string LinkedResourceId { get; set; } + [Newtonsoft.Json.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; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResourceProperties.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResourceProperties.cs new file mode 100644 index 000000000000..50e4104d7457 --- /dev/null +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ScopedResourceProperties.cs @@ -0,0 +1,58 @@ +// 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 System.Linq; + + /// + /// Properties of a private link scoped resource. + /// + public partial class ScopedResourceProperties + { + /// + /// Initializes a new instance of the ScopedResourceProperties class. + /// + public ScopedResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScopedResourceProperties class. + /// + + /// The resource id of the scoped Azure monitor resource. + /// + + /// State of the private endpoint connection. + /// + public ScopedResourceProperties(string linkedResourceId = default(string), string provisioningState = default(string)) + + { + this.LinkedResourceId = linkedResourceId; + this.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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "linkedResourceId")] + public string LinkedResourceId {get; set; } + + /// + /// Gets state of the private endpoint connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + } +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs index b039c91346dd..1d821db22a44 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SenderAuthorization.cs @@ -1,22 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 authorization used by the user who has performed the operation that - /// led to this event. This captures the RBAC properties of the event. - /// These usually include the 'action', 'role' and the 'scope' + /// the authorization used by the user who has performed the operation that led + /// to this event. This captures the RBAC properties of the event. These + /// usually include the 'action', 'role' and the 'scope' /// public partial class SenderAuthorization { @@ -31,16 +25,22 @@ public SenderAuthorization() /// /// Initializes a new instance of the SenderAuthorization class. /// + /// the permissible actions. For instance: - /// microsoft.support/supporttickets/write - /// the role of the user. For instance: Subscription - /// Admin - /// the scope. + /// microsoft.support/supporttickets/write + /// + + /// the role of the user. For instance: Subscription Admin + /// + + /// the scope. + /// public SenderAuthorization(string action = default(string), string role = default(string), string scope = default(string)) + { - Action = action; - Role = role; - Scope = scope; + this.Action = action; + this.Role = role; + this.Scope = scope; CustomInit(); } @@ -49,24 +49,24 @@ public SenderAuthorization() /// partial void CustomInit(); + /// /// Gets or sets the permissible actions. For instance: /// microsoft.support/supporttickets/write /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "action")] + public string Action {get; set; } /// /// Gets or sets the role of the user. For instance: Subscription Admin /// - [JsonProperty(PropertyName = "role")] - public string Role { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "role")] + public string Role {get; set; } /// /// Gets or sets the scope. /// - [JsonProperty(PropertyName = "scope")] - public string Scope { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "scope")] + public string Scope {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs index 8959f4d061eb..983ba0d0743b 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleBaseline.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,17 +23,21 @@ public SingleBaseline() /// /// Initializes a new instance of the SingleBaseline class. /// - /// the sensitivity of the baseline. Possible - /// values include: 'Low', 'Medium', 'High' - /// The low thresholds of the - /// baseline. - /// The high thresholds of the - /// baseline. - public SingleBaseline(string sensitivity, IList lowThresholds, IList highThresholds) + + /// the sensitivity of the baseline. + /// Possible values include: 'Low', 'Medium', 'High' + + /// The low thresholds of the baseline. + /// + + /// The high thresholds of the baseline. + /// + public SingleBaseline(string sensitivity, System.Collections.Generic.IList lowThresholds, System.Collections.Generic.IList highThresholds) + { - Sensitivity = sensitivity; - LowThresholds = lowThresholds; - HighThresholds = highThresholds; + this.Sensitivity = sensitivity; + this.LowThresholds = lowThresholds; + this.HighThresholds = highThresholds; CustomInit(); } @@ -51,45 +46,47 @@ public SingleBaseline(string sensitivity, IList lowThresholds, IList partial void CustomInit(); + /// - /// Gets or sets the sensitivity of the baseline. Possible values - /// include: 'Low', 'Medium', 'High' + /// Gets or sets the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' /// - [JsonProperty(PropertyName = "sensitivity")] - public string Sensitivity { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "sensitivity")] + public string Sensitivity {get; set; } /// /// Gets or sets the low thresholds of the baseline. /// - [JsonProperty(PropertyName = "lowThresholds")] - public IList LowThresholds { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "lowThresholds")] + public System.Collections.Generic.IList LowThresholds {get; set; } /// /// Gets or sets the high thresholds of the baseline. /// - [JsonProperty(PropertyName = "highThresholds")] - public IList HighThresholds { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "highThresholds")] + public System.Collections.Generic.IList HighThresholds {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Sensitivity == null) + if (this.Sensitivity == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Sensitivity"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Sensitivity"); } - if (LowThresholds == null) + if (this.LowThresholds == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "LowThresholds"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "LowThresholds"); } - if (HighThresholds == null) + if (this.HighThresholds == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "HighThresholds"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "HighThresholds"); } + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs index d7d36f282e52..2dd7ffe92f94 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/SingleMetricBaseline.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// /// The baseline results of a single metric. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class SingleMetricBaseline { /// @@ -34,32 +24,41 @@ public SingleMetricBaseline() /// /// Initializes a new instance of the SingleMetricBaseline class. /// - /// The metric baseline Id. - /// The resource type of the metric baseline - /// resource. - /// The name of the metric for which the baselines - /// were retrieved. - /// The timespan for which the data was - /// retrieved. Its value consists of two datetimes concatenated, - /// separated by '/'. This may be adjusted in the future and returned - /// back from what was originally requested. - /// The interval (window size) for which the - /// metric data was returned in. This may be adjusted in the future - /// and returned back from what was originally requested. This is not - /// present if a metadata request was made. - /// The baseline for each time series that was - /// queried. - /// The namespace of the metrics been - /// queried. - public SingleMetricBaseline(string id, string type, string name, string timespan, System.TimeSpan interval, IList baselines, string namespaceProperty = default(string)) + + /// The metric baseline Id. + /// + + /// The resource type of the metric baseline resource. + /// + + /// The name of the metric for which the baselines were retrieved. + /// + + /// The timespan for which the data was retrieved. Its value consists of two + /// datetimes concatenated, separated by '/'. This may be adjusted in the + /// future and returned back from what was originally requested. + /// + + /// The interval (window size) for which the metric data was returned in. This + /// may be adjusted in the future and returned back from what was originally + /// requested. This is not present if a metadata request was made. + /// + + /// The namespace of the metrics been queried. + /// + + /// The baseline for each time series that was queried. + /// + public SingleMetricBaseline(string id, string type, string name, string timespan, System.TimeSpan interval, System.Collections.Generic.IList baselines, string namespaceProperty = default(string)) + { - Id = id; - Type = type; - Name = name; - Timespan = timespan; - Interval = interval; - NamespaceProperty = namespaceProperty; - Baselines = baselines; + this.Id = id; + this.Type = type; + this.Name = name; + this.Timespan = timespan; + this.Interval = interval; + this.NamespaceProperty = namespaceProperty; + this.Baselines = baselines; CustomInit(); } @@ -68,86 +67,90 @@ public SingleMetricBaseline() /// partial void CustomInit(); + /// /// Gets or sets the metric baseline Id. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } /// /// Gets or sets the resource type of the metric baseline resource. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } /// - /// Gets or sets the name of the metric for which the baselines were - /// retrieved. + /// Gets or sets the name of the metric for which the baselines were retrieved. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// - /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datetimes concatenated, separated by '/'. - /// This may be adjusted in the future and returned back from what was - /// originally requested. + /// Gets or sets the timespan for which the data was retrieved. Its value + /// consists of two datetimes concatenated, separated by '/'. This may be + /// adjusted in the future and returned back from what was originally + /// requested. /// - [JsonProperty(PropertyName = "properties.timespan")] - public string Timespan { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timespan")] + public string Timespan {get; set; } /// - /// Gets or sets the interval (window size) for which the metric data - /// was returned in. This may be adjusted in the future and returned - /// back from what was originally requested. This is not present if a - /// metadata request was made. + /// Gets or sets the interval (window size) for which the metric data was + /// returned in. This may be adjusted in the future and returned back from + /// what was originally requested. This is not present if a metadata request + /// was made. /// - [JsonProperty(PropertyName = "properties.interval")] - public System.TimeSpan Interval { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.interval")] + public System.TimeSpan Interval {get; set; } /// /// Gets or sets the namespace of the metrics been queried. /// - [JsonProperty(PropertyName = "properties.namespace")] - public string NamespaceProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.namespace")] + public string NamespaceProperty {get; set; } /// /// Gets or sets the baseline for each time series that was queried. /// - [JsonProperty(PropertyName = "properties.baselines")] - public IList Baselines { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.baselines")] + public System.Collections.Generic.IList Baselines {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Id == null) + if (this.Id == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); } - if (Type == null) + if (this.Type == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type"); } - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } - if (Timespan == null) + if (this.Timespan == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Timespan"); } - if (Baselines == null) + if (this.Baselines == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Baselines"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Baselines"); } - if (Baselines != null) + + + + + + if (this.Baselines != null) { - foreach (var element in Baselines) + foreach (var element in this.Baselines) { if (element != null) { @@ -157,4 +160,4 @@ public virtual void Validate() } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs index 3dc9207c30c3..9c46fa91e6de 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TagsResource.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,10 +24,13 @@ public TagsResource() /// /// Initializes a new instance of the TagsResource class. /// - /// Resource tags - public TagsResource(IDictionary tags = default(IDictionary)) + + /// Resource tags + /// + public TagsResource(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Tags = tags; + this.Tags = tags; CustomInit(); } @@ -44,11 +39,11 @@ public TagsResource() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs index e376a972718d..f203db1ab2a2 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/ThresholdRuleCondition.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -30,30 +24,35 @@ public ThresholdRuleCondition() /// /// Initializes a new instance of the ThresholdRuleCondition class. /// - /// the operator used to compare the - /// data and the threshold. Possible values include: 'GreaterThan', - /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// the threshold value that activates the - /// alert. - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. - /// the time aggregation operator. How - /// the data that are collected should be combined over time. The - /// default value is the PrimaryAggregationType of the Metric. Possible - /// values include: 'Average', 'Minimum', 'Maximum', 'Total', - /// 'Last' + + /// the resource from which the rule collects its data. For this type + /// dataSource will always be of type RuleMetricDataSource. + /// + + /// the operator used to compare the data and the threshold. + /// Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + /// 'LessThanOrEqual' + + /// the threshold value that activates the alert. + /// + + /// the period of time (in ISO 8601 duration format) that is used to monitor + /// alert activity based on the threshold. If specified then it must be between + /// 5 minutes and 1 day. + /// + + /// the time aggregation operator. How the data that are collected should be + /// combined over time. The default value is the PrimaryAggregationType of the + /// Metric. + /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last' public ThresholdRuleCondition(ConditionOperator operatorProperty, double threshold, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?), TimeAggregationOperator? timeAggregation = default(TimeAggregationOperator?)) - : base(dataSource) + + : base(dataSource) { - OperatorProperty = operatorProperty; - Threshold = threshold; - WindowSize = windowSize; - TimeAggregation = timeAggregation; + this.OperatorProperty = operatorProperty; + this.Threshold = threshold; + this.WindowSize = windowSize; + this.TimeAggregation = timeAggregation; CustomInit(); } @@ -62,45 +61,44 @@ public ThresholdRuleCondition() /// partial void CustomInit(); + /// - /// Gets or sets the operator used to compare the data and the - /// threshold. Possible values include: 'GreaterThan', - /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + /// Gets or sets the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' /// - [JsonProperty(PropertyName = "operator")] - public ConditionOperator OperatorProperty { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "operator")] + public ConditionOperator OperatorProperty {get; set; } /// /// Gets or sets the threshold value that activates the alert. /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public double Threshold {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. If - /// specified then it must be between 5 minutes and 1 day. + /// Gets or sets the period of time (in ISO 8601 duration format) that is used + /// to monitor alert activity based on the threshold. If specified then it must + /// be between 5 minutes and 1 day. /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "windowSize")] + public System.TimeSpan? WindowSize {get; set; } /// - /// Gets or sets the time aggregation operator. How the data that are - /// collected should be combined over time. The default value is the - /// PrimaryAggregationType of the Metric. Possible values include: - /// 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + /// Gets or sets the time aggregation operator. How the data that are collected + /// should be combined over time. The default value is the + /// PrimaryAggregationType of the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last' /// - [JsonProperty(PropertyName = "timeAggregation")] - public TimeAggregationOperator? TimeAggregation { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "timeAggregation")] + public TimeAggregationOperator? TimeAggregation {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs index 863bbac3ce8a..28ccbc23e56b 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationOperator.cs @@ -1,35 +1,28 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for TimeAggregationOperator. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum TimeAggregationOperator { - [EnumMember(Value = "Average")] + [System.Runtime.Serialization.EnumMember(Value = "Average")] Average, - [EnumMember(Value = "Minimum")] + [System.Runtime.Serialization.EnumMember(Value = "Minimum")] Minimum, - [EnumMember(Value = "Maximum")] + [System.Runtime.Serialization.EnumMember(Value = "Maximum")] Maximum, - [EnumMember(Value = "Total")] + [System.Runtime.Serialization.EnumMember(Value = "Total")] Total, - [EnumMember(Value = "Last")] + [System.Runtime.Serialization.EnumMember(Value = "Last")] Last } internal static class TimeAggregationOperatorEnumExtension @@ -38,7 +31,6 @@ internal static string ToSerializedValue(this TimeAggregationOperator? value) { return value == null ? null : ((TimeAggregationOperator)value).ToSerializedValue(); } - internal static string ToSerializedValue(this TimeAggregationOperator value) { switch( value ) @@ -56,7 +48,6 @@ internal static string ToSerializedValue(this TimeAggregationOperator value) } return null; } - internal static TimeAggregationOperator? ParseTimeAggregationOperator(this string value) { switch( value ) @@ -75,4 +66,4 @@ internal static string ToSerializedValue(this TimeAggregationOperator value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs index 771c356ab52e..437040e7c9b4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeAggregationType.cs @@ -1,37 +1,30 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for TimeAggregationType. /// - [JsonConverter(typeof(StringEnumConverter))] + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum TimeAggregationType { - [EnumMember(Value = "Average")] + [System.Runtime.Serialization.EnumMember(Value = "Average")] Average, - [EnumMember(Value = "Minimum")] + [System.Runtime.Serialization.EnumMember(Value = "Minimum")] Minimum, - [EnumMember(Value = "Maximum")] + [System.Runtime.Serialization.EnumMember(Value = "Maximum")] Maximum, - [EnumMember(Value = "Total")] + [System.Runtime.Serialization.EnumMember(Value = "Total")] Total, - [EnumMember(Value = "Count")] + [System.Runtime.Serialization.EnumMember(Value = "Count")] Count, - [EnumMember(Value = "Last")] + [System.Runtime.Serialization.EnumMember(Value = "Last")] Last } internal static class TimeAggregationTypeEnumExtension @@ -40,7 +33,6 @@ internal static string ToSerializedValue(this TimeAggregationType? value) { return value == null ? null : ((TimeAggregationType)value).ToSerializedValue(); } - internal static string ToSerializedValue(this TimeAggregationType value) { switch( value ) @@ -60,7 +52,6 @@ internal static string ToSerializedValue(this TimeAggregationType value) } return null; } - internal static TimeAggregationType? ParseTimeAggregationType(this string value) { switch( value ) @@ -81,4 +72,4 @@ internal static string ToSerializedValue(this TimeAggregationType value) return null; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs index 931c37ed3405..b5b50d6034ab 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesBaseline.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -32,22 +23,29 @@ public TimeSeriesBaseline() /// /// Initializes a new instance of the TimeSeriesBaseline class. /// - /// The aggregation type of the - /// metric. - /// The list of timestamps of the - /// baselines. - /// The baseline values for each - /// sensitivity. - /// The dimensions of this time - /// series. - /// The baseline metadata values. - public TimeSeriesBaseline(string aggregation, IList timestamps, IList data, IList dimensions = default(IList), IList metadataValues = default(IList)) + + /// The aggregation type of the metric. + /// + + /// The dimensions of this time series. + /// + + /// The list of timestamps of the baselines. + /// + + /// The baseline values for each sensitivity. + /// + + /// The baseline metadata values. + /// + public TimeSeriesBaseline(string aggregation, System.Collections.Generic.IList timestamps, System.Collections.Generic.IList data, System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), System.Collections.Generic.IList metadataValues = default(System.Collections.Generic.IList)) + { - Aggregation = aggregation; - Dimensions = dimensions; - Timestamps = timestamps; - Data = data; - MetadataValues = metadataValues; + this.Aggregation = aggregation; + this.Dimensions = dimensions; + this.Timestamps = timestamps; + this.Data = data; + this.MetadataValues = metadataValues; CustomInit(); } @@ -56,59 +54,60 @@ public TimeSeriesBaseline() /// partial void CustomInit(); + /// /// Gets or sets the aggregation type of the metric. /// - [JsonProperty(PropertyName = "aggregation")] - public string Aggregation { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "aggregation")] + public string Aggregation {get; set; } /// /// Gets or sets the dimensions of this time series. /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "dimensions")] + public System.Collections.Generic.IList Dimensions {get; set; } /// /// Gets or sets the list of timestamps of the baselines. /// - [JsonProperty(PropertyName = "timestamps")] - public IList Timestamps { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timestamps")] + public System.Collections.Generic.IList Timestamps {get; set; } /// /// Gets or sets the baseline values for each sensitivity. /// - [JsonProperty(PropertyName = "data")] - public IList Data { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "data")] + public System.Collections.Generic.IList Data {get; set; } /// /// Gets or sets the baseline metadata values. /// - [JsonProperty(PropertyName = "metadataValues")] - public IList MetadataValues { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "metadataValues")] + public System.Collections.Generic.IList MetadataValues {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Aggregation == null) + if (this.Aggregation == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Aggregation"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Aggregation"); } - if (Timestamps == null) + if (this.Timestamps == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Timestamps"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Timestamps"); } - if (Data == null) + if (this.Data == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Data"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Data"); } - if (Dimensions != null) + + if (this.Dimensions != null) { - foreach (var element in Dimensions) + foreach (var element in this.Dimensions) { if (element != null) { @@ -116,26 +115,27 @@ public virtual void Validate() } } } - if (Data != null) + + if (this.Data != null) { - foreach (var element1 in Data) + foreach (var element in this.Data) { - if (element1 != null) + if (element != null) { - element1.Validate(); + element.Validate(); } } } - if (MetadataValues != null) + if (this.MetadataValues != null) { - foreach (var element2 in MetadataValues) + foreach (var element in this.MetadataValues) { - if (element2 != null) + if (element != null) { - element2.Validate(); + element.Validate(); } } } } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs index 6d30fba03f4f..3882ff22f3bd 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeSeriesElement.cs @@ -1,23 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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 time series result type. The discriminator value is always TimeSeries - /// in this case. + /// A time series result type. The discriminator value is always TimeSeries in + /// this case. /// public partial class TimeSeriesElement { @@ -32,15 +24,18 @@ public TimeSeriesElement() /// /// Initializes a new instance of the TimeSeriesElement class. /// - /// the metadata values returned if - /// $filter was specified in the call. - /// An array of data points representing the metric - /// values. This is only returned if a result type of data is - /// specified. - public TimeSeriesElement(IList metadatavalues = default(IList), IList data = default(IList)) + + /// the metadata values returned if $filter was specified in the call. + /// + + /// An array of data points representing the metric values. This is only + /// returned if a result type of data is specified. + /// + public TimeSeriesElement(System.Collections.Generic.IList metadatavalues = default(System.Collections.Generic.IList), System.Collections.Generic.IList data = default(System.Collections.Generic.IList)) + { - Metadatavalues = metadatavalues; - Data = data; + this.Metadatavalues = metadatavalues; + this.Data = data; CustomInit(); } @@ -49,20 +44,19 @@ public TimeSeriesElement() /// partial void CustomInit(); + /// - /// Gets or sets the metadata values returned if $filter was specified - /// in the call. + /// Gets or sets the metadata values returned if $filter was specified in the + /// call. /// - [JsonProperty(PropertyName = "metadatavalues")] - public IList Metadatavalues { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "metadatavalues")] + public System.Collections.Generic.IList Metadatavalues {get; set; } /// - /// Gets or sets an array of data points representing the metric - /// values. This is only returned if a result type of data is - /// specified. + /// Gets or sets an array of data points representing the metric values. This + /// is only returned if a result type of data is specified. /// - [JsonProperty(PropertyName = "data")] - public IList Data { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "data")] + public System.Collections.Generic.IList Data {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs index 6eba68156e24..dbca7d01990e 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/TimeWindow.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -29,58 +23,58 @@ public TimeWindow() /// /// Initializes a new instance of the TimeWindow class. /// - /// the start time for the profile in ISO 8601 - /// format. - /// the end time for the profile in ISO 8601 - /// format. - /// the timezone of the start and end times for - /// the profile. Some examples of valid time zones are: Dateline - /// Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard - /// Time, Pacific Standard Time (Mexico), Pacific Standard Time, US - /// Mountain Standard Time, Mountain Standard Time (Mexico), Mountain - /// Standard Time, Central America Standard Time, Central Standard - /// Time, Central Standard Time (Mexico), Canada Central Standard Time, - /// SA Pacific Standard Time, Eastern Standard Time, US Eastern - /// Standard Time, Venezuela Standard Time, Paraguay Standard Time, - /// Atlantic Standard Time, Central Brazilian Standard Time, SA Western - /// Standard Time, Pacific SA Standard Time, Newfoundland Standard - /// Time, E. South America Standard Time, Argentina Standard Time, SA - /// Eastern Standard Time, Greenland Standard Time, Montevideo Standard - /// Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, - /// Azores Standard Time, Cape Verde Standard Time, Morocco Standard - /// Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe - /// Standard Time, Central Europe Standard Time, Romance Standard Time, - /// Central European Standard Time, W. Central Africa Standard Time, - /// Namibia Standard Time, Jordan Standard Time, GTB Standard Time, - /// Middle East Standard Time, Egypt Standard Time, Syria Standard - /// Time, E. Europe Standard Time, South Africa Standard Time, FLE - /// Standard Time, Turkey Standard Time, Israel Standard Time, - /// Kaliningrad Standard Time, Libya Standard Time, Arabic Standard - /// Time, Arab Standard Time, Belarus Standard Time, Russian Standard - /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard - /// Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - /// Standard Time, Georgian Standard Time, Caucasus Standard Time, - /// Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg - /// Standard Time, Pakistan Standard Time, India Standard Time, Sri - /// Lanka Standard Time, Nepal Standard Time, Central Asia Standard - /// Time, Bangladesh Standard Time, N. Central Asia Standard Time, - /// Myanmar Standard Time, SE Asia Standard Time, North Asia Standard - /// Time, China Standard Time, North Asia East Standard Time, Singapore - /// Standard Time, W. Australia Standard Time, Taipei Standard Time, - /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard - /// Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS - /// Central Standard Time, E. Australia Standard Time, AUS Eastern - /// Standard Time, West Pacific Standard Time, Tasmania Standard Time, - /// Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone - /// 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - /// Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, - /// Tonga Standard Time, Samoa Standard Time, Line Islands Standard - /// Time + + /// the timezone of the start and end times for the profile. Some examples of + /// valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard + /// Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific + /// Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), + /// Mountain Standard Time, Central America Standard Time, Central Standard + /// Time, Central Standard Time (Mexico), Canada Central Standard Time, SA + /// Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, + /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, + /// Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + /// Standard Time, Newfoundland Standard Time, E. South America Standard Time, + /// Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, + /// Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic + /// Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco + /// Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe + /// Standard Time, Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia Standard + /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, + /// Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South + /// Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + /// Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + /// Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + /// Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + /// West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard + /// Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, + /// Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia + /// Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia + /// Standard Time, China Standard Time, North Asia East Standard Time, + /// Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, + /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + /// Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + /// Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + /// Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + /// Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + /// Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + /// Islands Standard Time + /// + + /// the start time for the profile in ISO 8601 format. + /// + + /// the end time for the profile in ISO 8601 format. + /// public TimeWindow(System.DateTime start, System.DateTime end, string timeZone = default(string)) + { - TimeZone = timeZone; - Start = start; - End = end; + this.TimeZone = timeZone; + this.Start = start; + this.End = end; CustomInit(); } @@ -89,74 +83,70 @@ public TimeWindow() /// partial void CustomInit(); + /// - /// Gets or sets the timezone of the start and end times for the - /// profile. Some examples of valid time zones are: Dateline Standard - /// Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - /// Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain - /// Standard Time, Mountain Standard Time (Mexico), Mountain Standard - /// Time, Central America Standard Time, Central Standard Time, Central - /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific - /// Standard Time, Eastern Standard Time, US Eastern Standard Time, - /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - /// Time, Central Brazilian Standard Time, SA Western Standard Time, - /// Pacific SA Standard Time, Newfoundland Standard Time, E. South - /// America Standard Time, Argentina Standard Time, SA Eastern Standard - /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia - /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT - /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, - /// Central Europe Standard Time, Romance Standard Time, Central - /// European Standard Time, W. Central Africa Standard Time, Namibia - /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East - /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe - /// Standard Time, South Africa Standard Time, FLE Standard Time, - /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard - /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard - /// Time, Belarus Standard Time, Russian Standard Time, E. Africa - /// Standard Time, Iran Standard Time, Arabian Standard Time, - /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard - /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard Time + /// Gets or sets the timezone of the start and end times for the profile. Some + /// examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian + /// Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + /// Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + /// (Mexico), Mountain Standard Time, Central America Standard Time, Central + /// Standard Time, Central Standard Time (Mexico), Canada Central Standard + /// Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard + /// Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard + /// Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + /// Standard Time, Newfoundland Standard Time, E. South America Standard Time, + /// Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, + /// Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic + /// Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco + /// Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe + /// Standard Time, Central Europe Standard Time, Romance Standard Time, Central + /// European Standard Time, W. Central Africa Standard Time, Namibia Standard + /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, + /// Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South + /// Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + /// Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + /// Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + /// Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + /// West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard + /// Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, + /// Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia + /// Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia + /// Standard Time, China Standard Time, North Asia East Standard Time, + /// Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, + /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + /// Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + /// Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + /// Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + /// Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + /// Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + /// Islands Standard Time /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZone")] + public string TimeZone {get; set; } /// /// Gets or sets the start time for the profile in ISO 8601 format. /// - [JsonProperty(PropertyName = "start")] - public System.DateTime Start { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "start")] + public System.DateTime Start {get; set; } /// /// Gets or sets the end time for the profile in ISO 8601 format. /// - [JsonProperty(PropertyName = "end")] - public System.DateTime End { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "end")] + public System.DateTime End {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - //Nothing to validate + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs index fb61f5519717..8ac541108a7d 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebhookNotification.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -31,14 +23,17 @@ public WebhookNotification() /// /// Initializes a new instance of the WebhookNotification class. /// - /// the service address to receive the - /// notification. - /// a property bag of settings. This value can - /// be empty. - public WebhookNotification(string serviceUri = default(string), IDictionary properties = default(IDictionary)) + + /// the service address to receive the notification. + /// + + /// a property bag of settings. This value can be empty. + /// + public WebhookNotification(string serviceUri = default(string), System.Collections.Generic.IDictionary properties = default(System.Collections.Generic.IDictionary)) + { - ServiceUri = serviceUri; - Properties = properties; + this.ServiceUri = serviceUri; + this.Properties = properties; CustomInit(); } @@ -47,17 +42,17 @@ public WebhookNotification() /// partial void CustomInit(); + /// /// Gets or sets the service address to receive the notification. /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "serviceUri")] + public string ServiceUri {get; set; } /// /// Gets or sets a property bag of settings. This value can be empty. /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public System.Collections.Generic.IDictionary Properties {get; set; } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs index 9ade80267628..3540a70baa1f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/WebtestLocationAvailabilityCriteria.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// 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; /// @@ -23,8 +14,7 @@ namespace Microsoft.Azure.Management.Monitor.Models public partial class WebtestLocationAvailabilityCriteria : MetricAlertCriteria { /// - /// Initializes a new instance of the - /// WebtestLocationAvailabilityCriteria class. + /// Initializes a new instance of the WebtestLocationAvailabilityCriteria class. /// public WebtestLocationAvailabilityCriteria() { @@ -32,23 +22,27 @@ public WebtestLocationAvailabilityCriteria() } /// - /// Initializes a new instance of the - /// WebtestLocationAvailabilityCriteria class. + /// Initializes a new instance of the WebtestLocationAvailabilityCriteria class. /// - /// The Application Insights web test - /// Id. - /// The Application Insights resource - /// Id. - /// The number of failed - /// locations. - /// Unmatched properties from the - /// message are deserialized this collection - public WebtestLocationAvailabilityCriteria(string webTestId, string componentId, double failedLocationCount, IDictionary additionalProperties = default(IDictionary)) - : base(additionalProperties) + + /// The rule criteria that defines the conditions of the alert rule. + /// + + /// The Application Insights web test Id. + /// + + /// The Application Insights resource Id. + /// + + /// The number of failed locations. + /// + public WebtestLocationAvailabilityCriteria(string webTestId, string componentId, double failedLocationCount, System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary)) + + : base(additionalProperties) { - WebTestId = webTestId; - ComponentId = componentId; - FailedLocationCount = failedLocationCount; + this.WebTestId = webTestId; + this.ComponentId = componentId; + this.FailedLocationCount = failedLocationCount; CustomInit(); } @@ -57,40 +51,42 @@ public WebtestLocationAvailabilityCriteria() /// partial void CustomInit(); + /// /// Gets or sets the Application Insights web test Id. /// - [JsonProperty(PropertyName = "webTestId")] - public string WebTestId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "webTestId")] + public string WebTestId {get; set; } /// /// Gets or sets the Application Insights resource Id. /// - [JsonProperty(PropertyName = "componentId")] - public string ComponentId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "componentId")] + public string ComponentId {get; set; } /// /// Gets or sets the number of failed locations. /// - [JsonProperty(PropertyName = "failedLocationCount")] - public double FailedLocationCount { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "failedLocationCount")] + public double FailedLocationCount {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (WebTestId == null) + if (this.WebTestId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "WebTestId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "WebTestId"); } - if (ComponentId == null) + if (this.ComponentId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ComponentId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ComponentId"); } + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs index 05a642c1468c..f0c12221182b 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/MonitorManagementClient.cs @@ -1,159 +1,128 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Serialization; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; /// /// Monitor Management Client /// - public partial class MonitorManagementClient : ServiceClient, IMonitorManagementClient, IAzureClient + public partial class MonitorManagementClient : Microsoft.Rest.ServiceClient, IMonitorManagementClient, IAzureClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } - /// /// Gets or sets json serialization settings. /// - public JsonSerializerSettings SerializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Credentials needed for the client to connect to Azure. /// - public ServiceClientCredentials Credentials { get; private set; } + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } /// /// The ID of the target subscription. /// - public string SubscriptionId { get; set; } + public string SubscriptionId { get; set;} /// /// The preferred language for the response. /// - public string AcceptLanguage { get; set; } + public string AcceptLanguage { get; set;} /// - /// The retry timeout in seconds for Long Running Operations. Default value is - /// 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. /// - public int? LongRunningOperationRetryTimeout { get; set; } + public int? LongRunningOperationRetryTimeout { get; set;} /// - /// Whether a unique x-ms-client-request-id should be generated. When set to - /// true a unique x-ms-client-request-id value is generated and included in - /// each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. /// - public bool? GenerateClientRequestId { get; set; } + public bool? GenerateClientRequestId { get; set;} /// - /// Gets the IAutoscaleSettingsOperations. + /// Gets the IAutoscaleSettingsOperations /// public virtual IAutoscaleSettingsOperations AutoscaleSettings { get; private set; } - /// - /// Gets the IAlertRulesOperations. + /// Gets the IAlertRulesOperations /// public virtual IAlertRulesOperations AlertRules { get; private set; } - /// - /// Gets the ILogProfilesOperations. + /// Gets the ILogProfilesOperations /// public virtual ILogProfilesOperations LogProfiles { get; private set; } - /// - /// Gets the IDiagnosticSettingsOperations. + /// Gets the IDiagnosticSettingsOperations /// public virtual IDiagnosticSettingsOperations DiagnosticSettings { get; private set; } - /// - /// Gets the IActivityLogsOperations. + /// Gets the IActivityLogsOperations /// public virtual IActivityLogsOperations ActivityLogs { get; private set; } - /// - /// Gets the IEventCategoriesOperations. + /// Gets the IEventCategoriesOperations /// public virtual IEventCategoriesOperations EventCategories { get; private set; } - /// - /// Gets the IMetricDefinitionsOperations. + /// Gets the IMetricDefinitionsOperations /// public virtual IMetricDefinitionsOperations MetricDefinitions { get; private set; } - /// - /// Gets the IMetricsOperations. + /// Gets the IMetricsOperations /// public virtual IMetricsOperations Metrics { get; private set; } - /// - /// Gets the IBaselinesOperations. + /// Gets the IBaselinesOperations /// public virtual IBaselinesOperations Baselines { get; private set; } - /// - /// Gets the IMetricAlertsOperations. + /// Gets the IMetricAlertsOperations /// public virtual IMetricAlertsOperations MetricAlerts { get; private set; } - /// - /// Gets the IMetricAlertsStatusOperations. + /// Gets the IMetricAlertsStatusOperations /// public virtual IMetricAlertsStatusOperations MetricAlertsStatus { get; private set; } - /// - /// Gets the IMetricNamespacesOperations. + /// Gets the IMetricNamespacesOperations /// public virtual IMetricNamespacesOperations MetricNamespaces { get; private set; } - /// - /// Gets the IPrivateLinkScopesOperations. + /// Gets the IPrivateLinkScopesOperations /// public virtual IPrivateLinkScopesOperations PrivateLinkScopes { get; private set; } - /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. + /// Gets the IPrivateLinkScopeOperationStatusOperations /// public virtual IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; private set; } - /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IPrivateLinkResourcesOperations /// public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } - /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IPrivateEndpointConnectionsOperations /// public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } - /// - /// Gets the IPrivateLinkScopedResourcesOperations. + /// Gets the IPrivateLinkScopedResourcesOperations /// public virtual IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; private set; } - /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -162,24 +131,22 @@ public partial class MonitorManagementClient : ServiceClient /// /// True: will dispose the provided httpClient on calling MonitorManagementClient.Dispose(). False: will not dispose provided httpClient - protected MonitorManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + protected MonitorManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the MonitorManagementClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MonitorManagementClient(params DelegatingHandler[] handlers) : base(handlers) + protected MonitorManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) { - Initialize(); + this.Initialize(); } - /// - /// Initializes a new instance of the MonitorManagementClient class. + /// Initializes a new instance of the MonitorManagementClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -187,11 +154,10 @@ protected MonitorManagementClient(params DelegatingHandler[] handlers) : base(ha /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MonitorManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected MonitorManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -204,15 +170,14 @@ protected MonitorManagementClient(HttpClientHandler rootHandler, params Delegati /// /// Thrown when a required parameter is null /// - protected MonitorManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected MonitorManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -228,15 +193,15 @@ protected MonitorManagementClient(System.Uri baseUri, params DelegatingHandler[] /// /// Thrown when a required parameter is null /// - protected MonitorManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected MonitorManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -249,23 +214,23 @@ protected MonitorManagementClient(System.Uri baseUri, HttpClientHandler rootHand /// /// Thrown when a required parameter is null /// - public MonitorManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public MonitorManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the MonitorManagementClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -276,23 +241,23 @@ public MonitorManagementClient(ServiceClientCredentials credentials, params Dele /// /// Thrown when a required parameter is null /// - public MonitorManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public MonitorManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the MonitorManagementClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -304,26 +269,26 @@ public MonitorManagementClient(ServiceClientCredentials credentials, HttpClient /// /// Thrown when a required parameter is null /// - public MonitorManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public MonitorManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the MonitorManagementClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -332,7 +297,7 @@ public MonitorManagementClient(ServiceClientCredentials credentials, HttpClientH /// /// Thrown when a required parameter is null /// - public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public MonitorManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -342,33 +307,30 @@ public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials cred { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the MonitorManagementClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// /// /// Thrown when a required parameter is null /// - public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public MonitorManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -378,83 +340,84 @@ public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials cred { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); + /// /// Initializes client properties. /// private void Initialize() { - AutoscaleSettings = new AutoscaleSettingsOperations(this); - AlertRules = new AlertRulesOperations(this); - LogProfiles = new LogProfilesOperations(this); - DiagnosticSettings = new DiagnosticSettingsOperations(this); - ActivityLogs = new ActivityLogsOperations(this); - EventCategories = new EventCategoriesOperations(this); - MetricDefinitions = new MetricDefinitionsOperations(this); - Metrics = new MetricsOperations(this); - Baselines = new BaselinesOperations(this); - MetricAlerts = new MetricAlertsOperations(this); - MetricAlertsStatus = new MetricAlertsStatusOperations(this); - MetricNamespaces = new MetricNamespacesOperations(this); - PrivateLinkScopes = new PrivateLinkScopesOperations(this); - PrivateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusOperations(this); - PrivateLinkResources = new PrivateLinkResourcesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); - PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); - BaseUri = new System.Uri("https://management.azure.com"); - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings + this.AutoscaleSettings = new AutoscaleSettingsOperations(this); + this.AlertRules = new AlertRulesOperations(this); + this.LogProfiles = new LogProfilesOperations(this); + this.DiagnosticSettings = new DiagnosticSettingsOperations(this); + this.ActivityLogs = new ActivityLogsOperations(this); + this.EventCategories = new EventCategoriesOperations(this); + this.MetricDefinitions = new MetricDefinitionsOperations(this); + this.Metrics = new MetricsOperations(this); + this.Baselines = new BaselinesOperations(this); + this.MetricAlerts = new MetricAlertsOperations(this); + this.MetricAlertsStatus = new MetricAlertsStatusOperations(this); + this.MetricNamespaces = new MetricNamespacesOperations(this); + this.PrivateLinkScopes = new PrivateLinkScopesOperations(this); + this.PrivateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusOperations(this); + this.PrivateLinkResources = new PrivateLinkResourcesOperations(this); + this.PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + this.PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings = new JsonSerializerSettings + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("criterionType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("criterionType")); + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("odata.type")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("odata.type")); + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter("criterionType")); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter("criterionType")); CustomInitialize(); - DeserializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs index f23a07af866b..e48d6bbb0db3 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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 + internal partial class PrivateEndpointConnectionsOperations : Microsoft.Rest.IServiceOperations, IPrivateEndpointConnectionsOperations { /// /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. @@ -36,13 +24,13 @@ internal partial class PrivateEndpointConnectionsOperations : IServiceOperations /// /// Thrown when a required parameter is null /// - internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) + internal PrivateEndpointConnectionsOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -68,13 +56,13 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -83,65 +71,75 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (privateEndpointConnectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -151,25 +149,24 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -181,55 +178,56 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -239,9 +237,10 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -252,25 +251,29 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Approve or reject a private endpoint connection with a given name. /// @@ -284,18 +287,19 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// The name of the private endpoint connection. /// /// + /// /// /// - /// The headers that will be added to request. + /// 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)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -311,16 +315,16 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// The name of the private endpoint connection. /// /// - /// The headers that will be added to request. + /// 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)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -338,13 +342,13 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -353,59 +357,68 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scopeName", scopeName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -415,25 +428,24 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -445,55 +457,56 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -503,9 +516,10 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -516,25 +530,29 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Approve or reject a private endpoint connection with a given name. /// @@ -548,6 +566,7 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// The name of the private endpoint connection. /// /// + /// /// /// /// Headers that will be added to request. @@ -555,13 +574,13 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -570,74 +589,84 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - if (Client.SubscriptionId != null) + if (parameters != null) { - if (Client.SubscriptionId.Length < 1) + parameters.Validate(); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (this.Client.SubscriptionId != null) + { + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.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(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -647,25 +676,24 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -677,61 +705,62 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -741,9 +770,10 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -754,25 +784,29 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a private endpoint connection with a given name. /// @@ -791,10 +825,10 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -803,65 +837,75 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (privateEndpointConnectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -871,25 +915,24 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -901,55 +944,56 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -959,20 +1003,25 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets all private endpoint connections on a private link scope. /// @@ -985,13 +1034,13 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1000,51 +1049,54 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1056,55 +1108,56 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1114,9 +1167,10 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1127,24 +1181,28 @@ internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs index f154ba186236..9e359104125c 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -1,331 +1,307 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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. + /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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(); - } + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 ((IPrivateEndpointConnectionsOperations)operations).GetAsync(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 is case insensitive. - /// - /// - /// 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)) + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + 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 is case insensitive. + /// + /// + /// 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 ((IPrivateEndpointConnectionsOperations)operations).CreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).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 is case insensitive. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// 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) + { + ((IPrivateEndpointConnectionsOperations)operations).DeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).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 is case insensitive. - /// - /// - /// 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; - } - } + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static Microsoft.Rest.Azure.IPage ListByPrivateLinkScope(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName) + { + return ((IPrivateEndpointConnectionsOperations)operations).ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).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 is case insensitive. - /// - /// - /// 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) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByPrivateLinkScopeAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// 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 ((IPrivateEndpointConnectionsOperations)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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + 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 is case insensitive. + /// + /// + /// 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) + { + ((IPrivateEndpointConnectionsOperations)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 is case insensitive. - /// - /// - /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 Microsoft.Rest.Azure.IPage ListByPrivateLinkScopeNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return ((IPrivateEndpointConnectionsOperations)operations).ListByPrivateLinkScopeNextAsync(nextPageLink).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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 System.Threading.Tasks.Task> ListByPrivateLinkScopeNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs index 19abc53f2f06..5eba2e026003 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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 + internal partial class PrivateLinkResourcesOperations : Microsoft.Rest.IServiceOperations, IPrivateLinkResourcesOperations { /// /// Initializes a new instance of the PrivateLinkResourcesOperations class. @@ -36,13 +24,13 @@ internal partial class PrivateLinkResourcesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PrivateLinkResourcesOperations(MonitorManagementClient client) + internal PrivateLinkResourcesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -66,13 +54,13 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -81,59 +69,68 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scopeName", scopeName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -143,25 +140,24 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -173,55 +169,56 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -231,9 +228,10 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -244,25 +242,29 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the private link resources that need to be created for a Azure Monitor /// PrivateLinkScope. @@ -282,13 +284,13 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -297,65 +299,75 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (groupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "groupName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -365,25 +377,24 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -395,55 +406,56 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -453,9 +465,10 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -466,25 +479,29 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the private link resources that need to be created for a Azure Monitor /// PrivateLinkScope. @@ -498,13 +515,13 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -513,51 +530,54 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -569,55 +589,56 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -627,9 +648,10 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -640,24 +662,28 @@ internal PrivateLinkResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs index 60ce383a270c..13f4309e8535 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -1,151 +1,139 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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. + /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static Microsoft.Rest.Azure.IPage ListByPrivateLinkScope(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName) + { + return ((IPrivateLinkResourcesOperations)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 is case insensitive. - /// - /// - /// 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) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByPrivateLinkScopeAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(resourceGroupName, scopeName, groupName).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// 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 ((IPrivateLinkResourcesOperations)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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the private link resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, string groupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, groupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, groupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + 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 Microsoft.Rest.Azure.IPage ListByPrivateLinkScopeNext(this IPrivateLinkResourcesOperations operations, string nextPageLink) + { + return ((IPrivateLinkResourcesOperations)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. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateLinkResourcesOperations operations, string nextPageLink) + /// + /// 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 System.Threading.Tasks.Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkResourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + 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. - /// - /// - /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs index 4ff6cb960b4d..9ef8eccfd946 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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 + internal partial class PrivateLinkScopeOperationStatusOperations : Microsoft.Rest.IServiceOperations, IPrivateLinkScopeOperationStatusOperations { /// /// Initializes a new instance of the PrivateLinkScopeOperationStatusOperations class. @@ -36,13 +24,13 @@ internal partial class PrivateLinkScopeOperationStatusOperations : IServiceOpera /// /// Thrown when a required parameter is null /// - internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient client) + internal PrivateLinkScopeOperationStatusOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -66,13 +54,13 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien /// /// 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 /// /// @@ -81,59 +69,68 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien /// /// 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)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (asyncOperationId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "asyncOperationId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "asyncOperationId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("asyncOperationId", asyncOperationId); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -143,25 +140,24 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -173,55 +169,56 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -231,9 +228,10 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -244,24 +242,28 @@ internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient clien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs index 67cfc122b2a1..1964fb30033f 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs @@ -1,67 +1,57 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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. + /// 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. The name is case insensitive. - /// - 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 name is case insensitive. + /// + public static OperationStatus Get(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName) + { + return ((IPrivateLinkScopeOperationStatusOperations)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 name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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 name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(asyncOperationId, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(asyncOperationId, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs index c7f8454f078d..113b34c39e29 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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 + internal partial class PrivateLinkScopedResourcesOperations : Microsoft.Rest.IServiceOperations, IPrivateLinkScopedResourcesOperations { /// /// Initializes a new instance of the PrivateLinkScopedResourcesOperations class. @@ -36,13 +24,13 @@ internal partial class PrivateLinkScopedResourcesOperations : IServiceOperations /// /// Thrown when a required parameter is null /// - internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) + internal PrivateLinkScopedResourcesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -68,13 +56,13 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -83,65 +71,75 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -151,25 +149,24 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -181,55 +178,56 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -239,9 +237,10 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -252,25 +251,29 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Approve or reject a private endpoint connection with a given name. /// @@ -287,16 +290,16 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// The resource id of the scoped Azure monitor resource. /// /// - /// The headers that will be added to request. + /// 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)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -312,16 +315,16 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// The name of the scoped resource object. /// /// - /// The headers that will be added to request. + /// 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)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -339,13 +342,13 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -354,59 +357,68 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scopeName", scopeName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -416,25 +428,24 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -446,55 +457,56 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -504,9 +516,10 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -517,25 +530,29 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Approve or reject a private endpoint connection with a given name. /// @@ -557,13 +574,13 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -572,71 +589,81 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2019-10-17-preview"; ScopedResource parameters = new ScopedResource(); - if (linkedResourceId != null) + if(linkedResourceId != null) { parameters.LinkedResourceId = linkedResourceId; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -646,25 +673,24 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -676,61 +702,62 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -740,9 +767,10 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -753,16 +781,16 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -771,25 +799,29 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a private endpoint connection with a given name. /// @@ -808,10 +840,10 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -820,65 +852,75 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -888,25 +930,24 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -918,55 +959,56 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -976,20 +1018,25 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets all private endpoint connections on a private link scope. /// @@ -1002,13 +1049,13 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1017,51 +1064,54 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScopeNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1073,55 +1123,56 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1131,9 +1182,10 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1144,24 +1196,28 @@ internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs index 9d1eb0b2ef67..b3cd2c6a31ea 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs @@ -1,335 +1,307 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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. + /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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(); - } + /// + /// Gets a scoped resource in a private link scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 ((IPrivateLinkScopedResourcesOperations)operations).GetAsync(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 is case insensitive. - /// - /// - /// 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)) + /// + /// Gets a scoped resource in a private link scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + public static ScopedResource CreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) + { + return ((IPrivateLinkScopedResourcesOperations)operations).CreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).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 is case insensitive. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// 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) + { + ((IPrivateLinkScopedResourcesOperations)operations).DeleteAsync(resourceGroupName, scopeName, name).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 is case insensitive. - /// - /// - /// 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; - } - } + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static Microsoft.Rest.Azure.IPage ListByPrivateLinkScope(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName) + { + return ((IPrivateLinkScopedResourcesOperations)operations).ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByPrivateLinkScopeAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + public static ScopedResource BeginCreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) + { + return ((IPrivateLinkScopedResourcesOperations)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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + 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 is case insensitive. + /// + /// + /// 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) + { + ((IPrivateLinkScopedResourcesOperations)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 is case insensitive. - /// - /// - /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The name of the scoped resource object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 Microsoft.Rest.Azure.IPage ListByPrivateLinkScopeNext(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink) + { + return ((IPrivateLinkScopedResourcesOperations)operations).ListByPrivateLinkScopeNextAsync(nextPageLink).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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 System.Threading.Tasks.Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } - - /// - /// 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/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs index 198c94b8b6c3..e2b63f23c38d 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Monitor { + using System.Linq; 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 + internal partial class PrivateLinkScopesOperations : Microsoft.Rest.IServiceOperations, IPrivateLinkScopesOperations { /// /// Initializes a new instance of the PrivateLinkScopesOperations class. @@ -36,13 +24,13 @@ internal partial class PrivateLinkScopesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PrivateLinkScopesOperations(MonitorManagementClient client) + internal PrivateLinkScopesOperations (MonitorManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -59,13 +47,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -74,36 +62,44 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -113,25 +109,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -143,55 +138,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -201,9 +197,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -214,25 +211,29 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. /// @@ -245,13 +246,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -260,53 +261,61 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -316,25 +325,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -346,55 +354,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -404,9 +413,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -417,25 +427,29 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a Azure Monitor PrivateLinkScope. /// @@ -446,16 +460,16 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// The name of the Azure Monitor PrivateLinkScope resource. /// /// - /// The headers that will be added to request. + /// 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)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -473,13 +487,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -488,59 +502,68 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scopeName", scopeName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -550,25 +573,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -580,55 +602,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -638,9 +661,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -651,25 +675,29 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.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 @@ -691,13 +719,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -706,68 +734,77 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + + if (azureMonitorPrivateLinkScopePayload == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "azureMonitorPrivateLinkScopePayload"); + } + if (azureMonitorPrivateLinkScopePayload != null) + { + azureMonitorPrivateLinkScopePayload.Validate(); + } if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (azureMonitorPrivateLinkScopePayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "azureMonitorPrivateLinkScopePayload"); - } - if (azureMonitorPrivateLinkScopePayload != null) - { - azureMonitorPrivateLinkScopePayload.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -777,25 +814,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -807,61 +843,62 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(azureMonitorPrivateLinkScopePayload, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -871,9 +908,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -884,16 +922,16 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -902,27 +940,31 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the + /// Updates an existing PrivateLinkScope's tags. To update other fields use the /// CreateOrUpdate method. /// /// @@ -940,13 +982,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -955,65 +997,74 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; TagsResource privateLinkScopeTags = new TagsResource(); - if (tags != null) + if(tags != null) { privateLinkScopeTags.Tags = tags; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1023,25 +1074,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1053,61 +1103,62 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(privateLinkScopeTags, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1117,9 +1168,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1130,25 +1182,29 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a Azure Monitor PrivateLinkScope. /// @@ -1164,10 +1220,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1176,59 +1232,68 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (Client.SubscriptionId == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.SubscriptionId != null) + if (this.Client.SubscriptionId != null) { - if (Client.SubscriptionId.Length < 1) + if (this.Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (scopeName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scopeName"); } + string apiVersion = "2019-10-17-preview"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scopeName", scopeName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1238,25 +1303,24 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1268,55 +1332,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1326,20 +1391,25 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. /// @@ -1352,13 +1422,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1367,51 +1437,54 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1423,55 +1496,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1481,9 +1555,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1494,25 +1569,29 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. /// @@ -1525,13 +1604,13 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// 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 /// /// @@ -1540,51 +1619,54 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1596,55 +1678,56 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1654,9 +1737,10 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1667,24 +1751,28 @@ internal PrivateLinkScopesOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs index 775786a5a3c9..95c1f4d357dc 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/PrivateLinkScopesOperationsExtensions.cs @@ -1,371 +1,337 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// 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. -// - +// 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. + /// 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. The name is case insensitive. - /// - 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 name is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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; - } - } + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IPrivateLinkScopesOperations operations) + { + return ((IPrivateLinkScopesOperations)operations).ListAsync().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 is case insensitive. - /// - /// - /// 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) + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPrivateLinkScopesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload).GetAwaiter().GetResult(); + 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. The name is case insensitive. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IPrivateLinkScopesOperations operations, string resourceGroupName) + { + return ((IPrivateLinkScopesOperations)operations).ListByResourceGroupAsync(resourceGroupName).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 is case insensitive. - /// - /// - /// 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)) + /// + /// 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 name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static void Delete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) + { + ((IPrivateLinkScopesOperations)operations).DeleteAsync(resourceGroupName, scopeName).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 is case insensitive. - /// - /// - /// 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 is case insensitive. - /// - /// - /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static AzureMonitorPrivateLinkScope Get(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) + { + return ((IPrivateLinkScopesOperations)operations).GetAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); + } - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static void BeginDelete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) + /// + /// Returns a Azure Monitor PrivateLinkScope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) { - operations.BeginDeleteAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); + 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static AzureMonitorPrivateLinkScope CreateOrUpdate(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload) + { + return ((IPrivateLinkScopesOperations)operations).CreateOrUpdateAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload).GetAwaiter().GetResult(); + } - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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)) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, null, cancellationToken).ConfigureAwait(false)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static AzureMonitorPrivateLinkScope UpdateTags(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { + return ((IPrivateLinkScopesOperations)operations).UpdateTagsAsync(resourceGroupName, scopeName, tags).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. - /// - public static IPage ListNext(this IPrivateLinkScopesOperations operations, string nextPageLink) + /// + /// 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 is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateTagsAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, scopeName, tags, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + public static void BeginDelete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) + { + ((IPrivateLinkScopesOperations)operations).BeginDeleteAsync(resourceGroupName, scopeName).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; - } - } + /// + /// Deletes a Azure Monitor PrivateLinkScope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 Microsoft.Rest.Azure.IPage ListNext(this IPrivateLinkScopesOperations operations, string nextPageLink) + { + return ((IPrivateLinkScopesOperations)operations).ListNextAsync(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. - /// - public static IPage ListByResourceGroupNext(this IPrivateLinkScopesOperations operations, string nextPageLink) + /// + /// 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 System.Threading.Tasks.Task> ListNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + 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 Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IPrivateLinkScopesOperations operations, string nextPageLink) + { + return ((IPrivateLinkScopesOperations)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)) + /// + /// 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs b/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs deleted file mode 100644 index 14838a1b84cb..000000000000 --- a/src/Monitor/Monitor.Management.Sdk/Generated/SdkInfo_MonitorManagementClient.cs +++ /dev/null @@ -1,43 +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 System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_MonitorManagementClient - { - get - { - return new Tuple[] - { - new Tuple("Insights", "ActivityLogs", "2015-04-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", "EventCategories", "2015-04-01"), - new Tuple("Insights", "LogProfiles", "2016-03-01"), - new Tuple("Insights", "MetricAlerts", "2018-03-01"), - new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), - new Tuple("Insights", "MetricDefinitions", "2018-01-01"), - new Tuple("Insights", "Metrics", "2018-01-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", "MetricNamespaces", "2017-12-01-preview"), - new Tuple("insights", "PrivateLinkScopeOperationStatus", "2019-10-17-preview"), - new Tuple("insights", "PrivateLinkScopes", "2019-10-17-preview"), - }.AsEnumerable(); - } - } - } -} diff --git a/src/Monitor/Monitor.Management.Sdk/README.md b/src/Monitor/Monitor.Management.Sdk/README.md index 8b7cca548afe..e536582f491d 100644 --- a/src/Monitor/Monitor.Management.Sdk/README.md +++ b/src/Monitor/Monitor.Management.Sdk/README.md @@ -5,14 +5,14 @@ This directory contains management plane service clients of Az.Monitor module. In this directory, run AutoRest: ``` autorest --reset -autorest --use:@microsoft.azure/autorest.csharp@2.3.90 -autorest.cmd README.md --version=v2 +autorest --use:@autorest/powershell@4.x ``` ### AutoRest Configuration > see https://aka.ms/autorest ``` yaml -csharp: true +isSdkGenerator: true +powershell: true clear-output-folder: true reflect-api-versions: true openapi-type: arm @@ -120,4 +120,9 @@ directive: from: autoscale_API.json where: $.paths reason: 'Operations API is defined in a separate swagger spec for Microsoft.Insights namespace (https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json)' + - where: + model-name: HttpRequestInfo + property-name: ClientIPAddress + set: + property-name: ClientIpAddress ``` \ No newline at end of file diff --git a/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs b/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs index 4a9174187ffc..d9f10cace897 100644 --- a/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs +++ b/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs @@ -56,7 +56,7 @@ public AddAzureRmMetricAlertRuleTests(ITestOutputHelper output) AlertRuleResource alertRuleResourceInput = new AlertRuleResource() { - AlertRuleResourceName = "a name", + PropertiesName = "a name", Location = null, IsEnabled = true }; @@ -252,7 +252,7 @@ private void AssertResult( Assert.Equal(actionsCount, this.alertRuleResource.Actions.Count); } - Assert.Equal(Utilities.Name, this.alertRuleResource.AlertRuleResourceName); + Assert.Equal(Utilities.Name, this.alertRuleResource.PropertiesName); Assert.Equal(isEnabled, this.alertRuleResource.IsEnabled); Assert.True(this.alertRuleResource.Condition is ThresholdRuleCondition); diff --git a/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs b/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs index f4065d6be8ce..082b152ae784 100644 --- a/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs +++ b/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs @@ -58,7 +58,7 @@ public AddAzureRmWebtestAlertRuleTests(ITestOutputHelper output) { Location = null, IsEnabled = true, - AlertRuleResourceName = "a name" + PropertiesName = "a name" }; response = new Rest.Azure.AzureOperationResponse() @@ -212,7 +212,7 @@ private void AssertResults(string location, string tagsKey, bool isEnabled, bool Assert.Equal(actionsCount, this.createOrUpdatePrms.Actions.Count); } - Assert.Equal(Utilities.Name, this.createOrUpdatePrms.AlertRuleResourceName); + Assert.Equal(Utilities.Name, this.createOrUpdatePrms.PropertiesName); Assert.Equal(isEnabled, this.createOrUpdatePrms.IsEnabled); Assert.True(this.createOrUpdatePrms.Condition is Management.Monitor.Models.LocationThresholdRuleCondition, "Checking type #1"); diff --git a/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs b/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs index d1f94a687ca4..4a69c8fe4feb 100644 --- a/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs +++ b/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs @@ -79,35 +79,35 @@ public void TestGetAzureRmAlertHistory() TestRunner.RunTestScript("Test-GetAzureRmAlertHistory"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestGetAzureRmMetricAlertRuleV2() { TestRunner.RunTestScript("Test-GetAzureRmMetricAlertRuleV2"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestRemoveAzureRmMetricAlertRuleV2() { TestRunner.RunTestScript("Test-RemoveAzureRmAlertRuleV2"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestAddAzureRmMetricAlertRuleV2() { TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestAddAzureRmMetricAlertRuleV2WithoutActionGroup() { TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-NoActionGroup"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestAddAzureRmMetricAlertRuleV2WithActionGroupId() { @@ -128,14 +128,14 @@ public void TestAddAzureRmMetricAlertRuleV2WithAutoMitigate() TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-autoMitigate"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestDisableAzureRmMetricAlertRuleV2WithActionGroups() { TestRunner.RunTestScript("Test-DisableAzureRmMetricAlertRuleV2WithActionGroups"); } - [Fact(Skip = "Test case fails due to the ActionGroup migration to autorest")] + [Fact] [Trait(Category.AcceptanceType, Category.LiveOnly)] public void TestAddAzureRmDynamicMetricAlertRuleV2() { diff --git a/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.ps1 b/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.ps1 index ca79ed1d5d1a..f29efd2ea556 100644 --- a/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.ps1 +++ b/src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.ps1 @@ -226,8 +226,8 @@ function Test-GetAzureRmMetricAlertRuleV2 $targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average @@ -265,8 +265,8 @@ function Test-RemoveAzureRmAlertRuleV2 $targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average @@ -303,8 +303,8 @@ function Test-AddAzureRmMetricAlertRuleV2 $targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average @@ -345,9 +345,9 @@ function Test-AddAzureRmMetricAlertRuleV2-NoActionGroup $targetResourceType = 'Microsoft.Storage/storageAccounts' New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup1 = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email - $NewActionGroup2 = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup1 = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location + $NewActionGroup2 = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup1.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average @@ -389,9 +389,9 @@ function Test-AddAzureRmMetricAlertRuleV2-ActionGroupId $targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup1 = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email - $NewActionGroup2 = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup1 = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location + $NewActionGroup2 = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup1.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average @@ -500,9 +500,9 @@ function Test-DisableAzureRmMetricAlertRuleV2WithActionGroups $targetResourceType = 'Microsoft.Storage/storageAccounts' New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $newActionGroup1 = Set-AzureRmActionGroup -Name $actionGroupName1 -ResourceGroup $rgname -ShortName ASTG -Receiver $email - $newActionGroup2 = Set-AzureRmActionGroup -Name $actionGroupName2 -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $newActionGroup1 = New-AzActionGroup -Name $actionGroupName1 -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location + $newActionGroup2 = New-AzActionGroup -Name $actionGroupName2 -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $condition = New-AzMetricAlertRuleV2Criteria -MetricName "UsedCapacity" -Operator GreaterThan -Threshold 8 -TimeAggregation Average try { @@ -549,8 +549,8 @@ function Test-AddAzureRmMetricAlertRuleV2-DynamicThreshold $targetResourceId = '/subscriptions/'+$subscription+'/resourceGroups/'+$rgname+'/providers/Microsoft.Storage/storageAccounts/'+$resourceName New-AzResourceGroup -Name $rgname -Location $location -Force New-AzStorageAccount -ResourceGroupName $rgname -Name $resourceName -Location $location -Type Standard_GRS - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "Transactions" -Operator GreaterThan -DynamicThreshold -TimeAggregation Total -Sensitivity High @@ -585,8 +585,8 @@ function Test-AddAzureRmMetricAlertRuleV2-Webtest $ruleName = Get-ResourceName $actionGroupName = Get-ResourceName New-AzResourceGroup -Name $rgname -Location $location -Force - $email = New-AzActionGroupReceiver -Name 'user1' -EmailReceiver -EmailAddress 'user1@example.com' - $NewActionGroup = Set-AzureRmActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -Receiver $email + $email = New-AzActionGroupEmailReceiverObject -Name 'user1' -EmailAddress 'user1@example.com' + $NewActionGroup = New-AzActionGroup -Name $actionGroupName -ResourceGroup $rgname -ShortName ASTG -EmailReceiver $email -Location $location $actionGroup = [Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup]::New() $actionGroup.ActionGroupId = $NewActionGroup.Id $condition = New-AzMetricAlertRuleV2Criteria -MetricName "Transactions" -Operator GreaterThan -DynamicThreshold -TimeAggregation Total -Sensitivity High diff --git a/src/Monitor/Monitor.Test/Utilities.cs b/src/Monitor/Monitor.Test/Utilities.cs index c85c82e3f675..bdf729e95d52 100644 --- a/src/Monitor/Monitor.Test/Utilities.cs +++ b/src/Monitor/Monitor.Test/Utilities.cs @@ -87,7 +87,7 @@ public static EventData CreateFakeEvent(string id = null, bool newDates = true) uri: "http://path/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy", method: "PUT", clientRequestId: "1234", - clientIpAddress: "123.123.123.123"), + clientIPAddress: "123.123.123.123"), properties: new Dictionary(), submissionTimestamp: newDates ? DateTime.Now : fixedDate); } @@ -332,7 +332,7 @@ public static AlertRuleResource CreateFakeRuleResource() return new AlertRuleResource( id: "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d", location: "East US", - alertRuleResourceName: Name, + propertiesName: Name, isEnabled: true, condition: condition) { diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs b/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs index 40488ed51218..b1962c589158 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs @@ -87,7 +87,7 @@ protected override void ProcessRecordInternal() AlertRuleResource parameters = this.CreateSdkCallParameters(); // Part of the result of this operation is operation (result.Body ==> a AutoscaleSettingResource) is being discarded for backwards compatibility - var result = this.MonitorManagementClient.AlertRules.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName: this.ResourceGroupName, parameters: parameters, ruleName: parameters.AlertRuleResourceName).Result; + var result = this.MonitorManagementClient.AlertRules.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName: this.ResourceGroupName, parameters: parameters, ruleName: parameters.PropertiesName).Result; var response = new PSAddAlertRuleOperationResponse { diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs index 8d40b68eabbd..943d094db0aa 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs @@ -100,7 +100,7 @@ protected override AlertRuleResource CreateSdkCallParameters() Actions = this.Action?.Select(TransitionHelpers.ToMirrorNamespace).ToList(), Location = this.Location, IsEnabled = !this.DisableRule, - AlertRuleResourceName = this.Name, + PropertiesName = this.Name, // DO NOT REMOVE OR CHANGE the following. The two elements in the Tags are required by other services. Tags = new Dictionary() diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleV2Command.cs b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleV2Command.cs index 25f2f113b7ea..8a8c7ffb2079 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleV2Command.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleV2Command.cs @@ -150,13 +150,13 @@ protected override void ProcessRecordInternal() actions.AddRange(newActionGroupIds.Select(actionGroupId => new MetricAlertAction(actionGroupId: actionGroupId))); } - if (this.Condition.Any(c => c.CriterionType == CriterionType.DynamicThresholdCriterion)) + if (this.Condition.Any(c => c.CriterionType == OutputClasses.CriterionType.DynamicThresholdCriterion)) { this.TargetResourceScope = this.TargetResourceScope ?? new string[] { this.TargetResourceId }; } IDictionary tags = null; - if (this.Condition.Any(c => c.CriterionType == CriterionType.WebtestLocationAvailabilityCriterion)) + if (this.Condition.Any(c => c.CriterionType == OutputClasses.CriterionType.WebtestLocationAvailabilityCriterion)) { var scopes = this.TargetResourceScope?.ToList() ?? new List { this.TargetResourceId }; MetricAlertCriteria criteria; diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs b/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs index d5e0f8e0c2ae..cbf2a33e7d17 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs @@ -89,7 +89,7 @@ protected override AlertRuleResource CreateSdkCallParameters() Actions = this.Action?.Select(TransitionHelpers.ToMirrorNamespace).ToList(), Location = this.Location, IsEnabled = !this.DisableRule, - AlertRuleResourceName = this.Name, + PropertiesName = this.Name, // DO NOT REMOVE OR CHANGE the following. The two elements in the Tags are required by other services. Tags = new Dictionary() diff --git a/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs b/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs index bca6e0ba86f9..63eb4aa018cf 100644 --- a/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs +++ b/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs @@ -31,7 +31,7 @@ public PSAlertRuleResource(AlertRuleResource ruleSpec) location: ruleSpec.Location, name: ruleSpec.Name, type: ruleSpec.Type, - alertRuleResourceName: ruleSpec.Name, + propertiesName: ruleSpec.Name, isEnabled: ruleSpec.IsEnabled, condition: ruleSpec.Condition, lastUpdatedTime: ruleSpec.LastUpdatedTime) diff --git a/src/Monitor/Monitor/PrivateLinkScopes/GetAzureInsightsPrivateLinkScopedResource.cs b/src/Monitor/Monitor/PrivateLinkScopes/GetAzureInsightsPrivateLinkScopedResource.cs index 21b7022fdbbb..b667d0c15421 100644 --- a/src/Monitor/Monitor/PrivateLinkScopes/GetAzureInsightsPrivateLinkScopedResource.cs +++ b/src/Monitor/Monitor/PrivateLinkScopes/GetAzureInsightsPrivateLinkScopedResource.cs @@ -87,11 +87,11 @@ protected override void ProcessRecordInternal() { identifier = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = identifier.ResourceGroupName; - this.ScopeName = identifier.ParentResource; + this.ScopeName = identifier.ParentResource.Split('/')[1]; this.Name = identifier.ResourceName; } - if (!this.IsParameterBound(c => c.Name)) + if (string.IsNullOrEmpty(this.Name)) { var response = this.MonitorManagementClient .PrivateLinkScopedResources @@ -99,7 +99,7 @@ protected override void ProcessRecordInternal() .Result; WriteObject(response.Body.Select(scope => PSMonitorPrivateLinkScopedResource.ToPSMonitorPrivateLinkScopedResource(scope)).ToList(), true); } - else if (this.IsParameterBound(c => c.Name)) + else { var response = this.MonitorManagementClient .PrivateLinkScopedResources diff --git a/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs b/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs index f61dbbb68616..fd6cfb895a2c 100644 --- a/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs +++ b/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs @@ -77,7 +77,7 @@ public AlertRuleResource(Monitor.Models.AlertRuleResource alertRuleResource) name: alertRuleResource?.Name, type: alertRuleResource?.Type, tags: alertRuleResource?.Tags, - alertRuleResourceName: alertRuleResource?.AlertRuleResourceName, + propertiesName: alertRuleResource?.PropertiesName, description: alertRuleResource?.Description, actions: alertRuleResource?.Actions, isEnabled: alertRuleResource == null ? false : alertRuleResource.IsEnabled, diff --git a/src/Monitor/Monitor/TransitionalClasses/AutoscaleSettingResource.cs b/src/Monitor/Monitor/TransitionalClasses/AutoscaleSettingResource.cs index f1dd911294e4..046e0849f65c 100644 --- a/src/Monitor/Monitor/TransitionalClasses/AutoscaleSettingResource.cs +++ b/src/Monitor/Monitor/TransitionalClasses/AutoscaleSettingResource.cs @@ -47,7 +47,7 @@ public AutoscaleSettingResource(Monitor.Models.AutoscaleSettingResource autoscal tags: autoscaleSettingResource?.Tags, notifications: autoscaleSettingResource?.Notifications, enabled: autoscaleSettingResource?.Enabled, - autoscaleSettingResourceName: autoscaleSettingResource?.AutoscaleSettingResourceName, + propertiesName: autoscaleSettingResource?.PropertiesName, targetResourceUri: autoscaleSettingResource?.TargetResourceUri) { this.Profiles = autoscaleSettingResource?.Profiles?.Select(Commands.Insights.TransitionalClasses.TransitionHelpers.ConvertNamespace).ToList(); From 7abddd85b6fa9475e4e29b92de37402cdc61812e Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Wed, 25 Dec 2024 10:05:25 +0800 Subject: [PATCH 3/8] PropertiesName renaming --- .../Generated/Models/AlertRuleResource.cs | 12 ++++++------ src/Monitor/Monitor.Management.Sdk/README.md | 5 +++++ .../Alerts/AddAzureRmMetricAlertRuleTests.cs | 4 ++-- .../Alerts/AddAzureRmWebtestAlertRuleTests.cs | 4 ++-- src/Monitor/Monitor.Test/Utilities.cs | 2 +- .../Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs | 2 +- .../Alerts/AddAzureRmMetricAlertRuleCommand.cs | 2 +- .../Alerts/AddAzureRmWebtestAlertRuleCommand.cs | 2 +- .../Monitor/OutputClasses/PSAlertRuleResource.cs | 2 +- .../Monitor/TransitionalClasses/AlertRuleResource.cs | 2 +- 10 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs index f21ebd6fab6c..f2564110ac34 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/AlertRuleResource.cs @@ -40,7 +40,7 @@ public AlertRuleResource() /// Resource tags /// - /// the name of the alert rule. + /// the name of the alert rule. /// /// the description of the alert rule that will be included in the alert email. @@ -65,11 +65,11 @@ public AlertRuleResource() /// Last time the rule was updated in ISO8601 format. /// - public AlertRuleResource(string location, string propertiesName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) + public AlertRuleResource(string location, string alertRuleResourceName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string provisioningState = default(string), RuleAction action = default(RuleAction), System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) : base(location, id, name, type, tags) { - this.PropertiesName = propertiesName; + this.AlertRuleResourceName = alertRuleResourceName; this.Description = description; this.ProvisioningState = provisioningState; this.IsEnabled = isEnabled; @@ -90,7 +90,7 @@ public AlertRuleResource() /// Gets or sets the name of the alert rule. /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] - public string PropertiesName {get; set; } + public string AlertRuleResourceName {get; set; } /// /// Gets or sets the description of the alert rule that will be included in the @@ -145,9 +145,9 @@ public AlertRuleResource() public override void Validate() { base.Validate(); - if (this.PropertiesName == null) + if (this.AlertRuleResourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PropertiesName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AlertRuleResourceName"); } if (this.Condition == null) { diff --git a/src/Monitor/Monitor.Management.Sdk/README.md b/src/Monitor/Monitor.Management.Sdk/README.md index e536582f491d..30abaa7701bb 100644 --- a/src/Monitor/Monitor.Management.Sdk/README.md +++ b/src/Monitor/Monitor.Management.Sdk/README.md @@ -125,4 +125,9 @@ directive: property-name: ClientIPAddress set: property-name: ClientIpAddress + - where: + model-name: AlertRuleResource + property-name: PropertiesName + set: + property-name: AlertRuleResourceName ``` \ No newline at end of file diff --git a/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs b/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs index d9f10cace897..4a9174187ffc 100644 --- a/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs +++ b/src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs @@ -56,7 +56,7 @@ public AddAzureRmMetricAlertRuleTests(ITestOutputHelper output) AlertRuleResource alertRuleResourceInput = new AlertRuleResource() { - PropertiesName = "a name", + AlertRuleResourceName = "a name", Location = null, IsEnabled = true }; @@ -252,7 +252,7 @@ private void AssertResult( Assert.Equal(actionsCount, this.alertRuleResource.Actions.Count); } - Assert.Equal(Utilities.Name, this.alertRuleResource.PropertiesName); + Assert.Equal(Utilities.Name, this.alertRuleResource.AlertRuleResourceName); Assert.Equal(isEnabled, this.alertRuleResource.IsEnabled); Assert.True(this.alertRuleResource.Condition is ThresholdRuleCondition); diff --git a/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs b/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs index 082b152ae784..f4065d6be8ce 100644 --- a/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs +++ b/src/Monitor/Monitor.Test/Alerts/AddAzureRmWebtestAlertRuleTests.cs @@ -58,7 +58,7 @@ public AddAzureRmWebtestAlertRuleTests(ITestOutputHelper output) { Location = null, IsEnabled = true, - PropertiesName = "a name" + AlertRuleResourceName = "a name" }; response = new Rest.Azure.AzureOperationResponse() @@ -212,7 +212,7 @@ private void AssertResults(string location, string tagsKey, bool isEnabled, bool Assert.Equal(actionsCount, this.createOrUpdatePrms.Actions.Count); } - Assert.Equal(Utilities.Name, this.createOrUpdatePrms.PropertiesName); + Assert.Equal(Utilities.Name, this.createOrUpdatePrms.AlertRuleResourceName); Assert.Equal(isEnabled, this.createOrUpdatePrms.IsEnabled); Assert.True(this.createOrUpdatePrms.Condition is Management.Monitor.Models.LocationThresholdRuleCondition, "Checking type #1"); diff --git a/src/Monitor/Monitor.Test/Utilities.cs b/src/Monitor/Monitor.Test/Utilities.cs index bdf729e95d52..d682f2025a99 100644 --- a/src/Monitor/Monitor.Test/Utilities.cs +++ b/src/Monitor/Monitor.Test/Utilities.cs @@ -332,7 +332,7 @@ public static AlertRuleResource CreateFakeRuleResource() return new AlertRuleResource( id: "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d", location: "East US", - propertiesName: Name, + alertRuleResourceName: Name, isEnabled: true, condition: condition) { diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs b/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs index b1962c589158..40488ed51218 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmAlertRuleCommandBase.cs @@ -87,7 +87,7 @@ protected override void ProcessRecordInternal() AlertRuleResource parameters = this.CreateSdkCallParameters(); // Part of the result of this operation is operation (result.Body ==> a AutoscaleSettingResource) is being discarded for backwards compatibility - var result = this.MonitorManagementClient.AlertRules.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName: this.ResourceGroupName, parameters: parameters, ruleName: parameters.PropertiesName).Result; + var result = this.MonitorManagementClient.AlertRules.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName: this.ResourceGroupName, parameters: parameters, ruleName: parameters.AlertRuleResourceName).Result; var response = new PSAddAlertRuleOperationResponse { diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs index 943d094db0aa..8d40b68eabbd 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleCommand.cs @@ -100,7 +100,7 @@ protected override AlertRuleResource CreateSdkCallParameters() Actions = this.Action?.Select(TransitionHelpers.ToMirrorNamespace).ToList(), Location = this.Location, IsEnabled = !this.DisableRule, - PropertiesName = this.Name, + AlertRuleResourceName = this.Name, // DO NOT REMOVE OR CHANGE the following. The two elements in the Tags are required by other services. Tags = new Dictionary() diff --git a/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs b/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs index cbf2a33e7d17..d5e0f8e0c2ae 100644 --- a/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs +++ b/src/Monitor/Monitor/Alerts/AddAzureRmWebtestAlertRuleCommand.cs @@ -89,7 +89,7 @@ protected override AlertRuleResource CreateSdkCallParameters() Actions = this.Action?.Select(TransitionHelpers.ToMirrorNamespace).ToList(), Location = this.Location, IsEnabled = !this.DisableRule, - PropertiesName = this.Name, + AlertRuleResourceName = this.Name, // DO NOT REMOVE OR CHANGE the following. The two elements in the Tags are required by other services. Tags = new Dictionary() diff --git a/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs b/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs index 63eb4aa018cf..bca6e0ba86f9 100644 --- a/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs +++ b/src/Monitor/Monitor/OutputClasses/PSAlertRuleResource.cs @@ -31,7 +31,7 @@ public PSAlertRuleResource(AlertRuleResource ruleSpec) location: ruleSpec.Location, name: ruleSpec.Name, type: ruleSpec.Type, - propertiesName: ruleSpec.Name, + alertRuleResourceName: ruleSpec.Name, isEnabled: ruleSpec.IsEnabled, condition: ruleSpec.Condition, lastUpdatedTime: ruleSpec.LastUpdatedTime) diff --git a/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs b/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs index fd6cfb895a2c..f61dbbb68616 100644 --- a/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs +++ b/src/Monitor/Monitor/TransitionalClasses/AlertRuleResource.cs @@ -77,7 +77,7 @@ public AlertRuleResource(Monitor.Models.AlertRuleResource alertRuleResource) name: alertRuleResource?.Name, type: alertRuleResource?.Type, tags: alertRuleResource?.Tags, - propertiesName: alertRuleResource?.PropertiesName, + alertRuleResourceName: alertRuleResource?.AlertRuleResourceName, description: alertRuleResource?.Description, actions: alertRuleResource?.Actions, isEnabled: alertRuleResource == null ? false : alertRuleResource.IsEnabled, From 9a30e690a1ef257c705cfbd68d9703a5c78e43c9 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:16:21 +0800 Subject: [PATCH 4/8] MultiMetricCriteria AdditionalProperties fix --- src/Monitor/Monitor.Management.Sdk/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Monitor/Monitor.Management.Sdk/README.md b/src/Monitor/Monitor.Management.Sdk/README.md index 30abaa7701bb..e15e28f6f367 100644 --- a/src/Monitor/Monitor.Management.Sdk/README.md +++ b/src/Monitor/Monitor.Management.Sdk/README.md @@ -130,4 +130,8 @@ directive: property-name: PropertiesName set: property-name: AlertRuleResourceName + # metricAlert_API.json + - from: swagger-document + where: $.definitions.MultiMetricCriteria + transform: $['additionalProperties'] = true ``` \ No newline at end of file From 830b0111eac6f20c3de993d29a3cf41a1dd93686 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 6 Jan 2025 02:28:54 +0000 Subject: [PATCH 5/8] Revert "MultiMetricCriteria AdditionalProperties fix" This reverts commit 9a30e690a1ef257c705cfbd68d9703a5c78e43c9. --- src/Monitor/Monitor.Management.Sdk/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Monitor/Monitor.Management.Sdk/README.md b/src/Monitor/Monitor.Management.Sdk/README.md index e15e28f6f367..30abaa7701bb 100644 --- a/src/Monitor/Monitor.Management.Sdk/README.md +++ b/src/Monitor/Monitor.Management.Sdk/README.md @@ -130,8 +130,4 @@ directive: property-name: PropertiesName set: property-name: AlertRuleResourceName - # metricAlert_API.json - - from: swagger-document - where: $.definitions.MultiMetricCriteria - transform: $['additionalProperties'] = true ``` \ No newline at end of file From 6eea26da46287611cad22b44e9c1a782d00ffab3 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 6 Jan 2025 02:37:26 +0000 Subject: [PATCH 6/8] autorest fix a object contains properties and additional properties --- .../Generated/Models/DynamicMetricCriteria.cs | 7 +++++-- .../Generated/Models/MetricCriteria.cs | 7 +++++-- .../Generated/Models/MultiMetricCriteria.cs | 13 ++++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs index 1324d2b809d6..f7ed169f45da 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/DynamicMetricCriteria.cs @@ -25,6 +25,9 @@ public DynamicMetricCriteria() /// Initializes a new instance of the DynamicMetricCriteria class. /// + /// The types of conditions for a multi resource alert. + /// + /// Name of the criteria. /// @@ -58,9 +61,9 @@ 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, string timeAggregation, string operatorProperty, string alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.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, System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary), string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?), System.DateTime? ignoreDataBefore = default(System.DateTime?)) - : base(name, metricName, timeAggregation, metricNamespace, dimensions, skipMetricValidation) + : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) { this.OperatorProperty = operatorProperty; this.AlertSensitivity = alertSensitivity; diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs index 546f0fe44612..1737fb3e70dc 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MetricCriteria.cs @@ -25,6 +25,9 @@ public MetricCriteria() /// Initializes a new instance of the MetricCriteria class. /// + /// The types of conditions for a multi resource alert. + /// + /// Name of the criteria. /// @@ -50,9 +53,9 @@ public MetricCriteria() /// the criteria threshold value that activates the alert. /// - public MetricCriteria(string name, string metricName, string timeAggregation, string operatorProperty, double threshold, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) + public MetricCriteria(string name, string metricName, string timeAggregation, string operatorProperty, double threshold, System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary), string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) - : base(name, metricName, timeAggregation, metricNamespace, dimensions, skipMetricValidation) + : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) { this.OperatorProperty = operatorProperty; this.Threshold = threshold; diff --git a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs index 5566431ceb4e..ebebe36878b4 100644 --- a/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs +++ b/src/Monitor/Monitor.Management.Sdk/Generated/Models/MultiMetricCriteria.cs @@ -25,6 +25,9 @@ public MultiMetricCriteria() /// Initializes a new instance of the MultiMetricCriteria class. /// + /// The types of conditions for a multi resource alert. + /// + /// Name of the criteria. /// @@ -43,9 +46,10 @@ 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, string timeAggregation, string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) + public MultiMetricCriteria(string name, string metricName, string timeAggregation, System.Collections.Generic.IDictionary additionalProperties = default(System.Collections.Generic.IDictionary), string metricNamespace = default(string), System.Collections.Generic.IList dimensions = default(System.Collections.Generic.IList), bool? skipMetricValidation = default(bool?)) { + this.AdditionalProperties = additionalProperties; this.Name = name; this.MetricName = metricName; this.MetricNamespace = metricNamespace; @@ -61,6 +65,12 @@ public MultiMetricCriteria() partial void CustomInit(); + /// + /// Gets or sets the types of conditions for a multi resource alert. + /// + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties {get; set; } + /// /// Gets or sets name of the criteria. /// @@ -121,6 +131,7 @@ public virtual void Validate() + if (this.Dimensions != null) { foreach (var element in this.Dimensions) From f59b372dc1242e35fd31479cb5ba12bc6c8c8128 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Sat, 8 Feb 2025 02:17:57 +0000 Subject: [PATCH 7/8] migration monitor breaking changes --- .../Exceptions/Az.Monitor/BreakingChangeIssue.csv | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv diff --git a/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv new file mode 100644 index 000000000000..f32b140cb81f --- /dev/null +++ b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv @@ -0,0 +1,15 @@ +"Module","ClassName","Target","Severity","ProblemId","Description","Remediation" +"Az.Monitor","Microsoft.Azure.Commands.Insights.LogProfiles.AddAzureRmLogProfileCommand","Add-AzLogProfile","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.LogProfiles.AddAzureRmLogProfileCommand","Add-AzLogProfile","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmMetricAlertRuleCommand","Add-AzMetricAlertRule","0","3010","The property 'Kind' of type 'Microsoft.Azure.Management.Monitor.Management.Models.AlertRuleResource' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Management.Monitor.Management.Models.AlertRuleResource'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmMetricAlertRuleCommand","Add-AzMetricAlertRule","0","3010","The property 'Etag' of type 'Microsoft.Azure.Management.Monitor.Management.Models.AlertRuleResource' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Management.Monitor.Management.Models.AlertRuleResource'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmMetricAlertRuleV2Command","Add-AzMetricAlertRuleV2","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmMetricAlertRuleV2Command","Add-AzMetricAlertRuleV2","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.GetAzureRmAlertRuleCommand","Get-AzAlertRule","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSAlertRule' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSAlertRule'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.GetAzureRmAlertRuleCommand","Get-AzAlertRule","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSAlertRule' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSAlertRule'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.LogProfiles.GetAzureRmLogProfileCommand","Get-AzLogProfile","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.LogProfiles.GetAzureRmLogProfileCommand","Get-AzLogProfile","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.GetAzureRmMetricAlertRuleV2Command","Get-AzMetricAlertRuleV2","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.GetAzureRmMetricAlertRuleV2Command","Get-AzMetricAlertRuleV2","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.RemoveAzureRmMetricAlertRuleV2Command","Remove-AzMetricAlertRuleV2","0","3010","The property 'Kind' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Kind' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." +"Az.Monitor","Microsoft.Azure.Commands.Insights.Alerts.RemoveAzureRmMetricAlertRuleV2Command","Remove-AzMetricAlertRuleV2","0","3010","The property 'Etag' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2' has been removed.","Add the property 'Etag' back to type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricAlertRuleV2'." \ No newline at end of file From e0b25c255f0cf0f3e9ffd19524a1e53e5b83d014 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Sat, 8 Feb 2025 03:35:54 +0000 Subject: [PATCH 8/8] file renaming --- .../{BreakingChangeIssue.csv => BreakingChangeIssues.csv} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tools/StaticAnalysis/Exceptions/Az.Monitor/{BreakingChangeIssue.csv => BreakingChangeIssues.csv} (100%) diff --git a/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv similarity index 100% rename from tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssue.csv rename to tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv