diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index c4347fe6a0d5..7ae35331e7fc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,503 @@ # Release History +## 0.12.0 (2025-05-05) +### Breaking Changes + +- Type of `ErrorContract.Error` has been changed from `*ErrorResponse` to `*ErrorResponseAutoGenerated` +- Enum `AccessMode` has been removed +- Enum `ActionType` has been removed +- Enum `AggregationType` has been removed +- Enum `AggregationTypeEnum` has been removed +- Enum `BaselineSensitivity` has been removed +- Enum `CategoryType` has been removed +- Enum `ComparisonOperationType` has been removed +- Enum `DataStatus` has been removed +- Enum `DynamicThresholdOperator` has been removed +- Enum `DynamicThresholdSensitivity` has been removed +- Enum `EventLevel` has been removed +- Enum `KnownColumnDefinitionType` has been removed +- Enum `KnownDataCollectionEndpointProvisioningState` has been removed +- Enum `KnownDataCollectionEndpointResourceKind` has been removed +- Enum `KnownDataCollectionRuleAssociationProvisioningState` has been removed +- Enum `KnownDataCollectionRuleProvisioningState` has been removed +- Enum `KnownDataCollectionRuleResourceKind` has been removed +- Enum `KnownDataFlowStreams` has been removed +- Enum `KnownExtensionDataSourceStreams` has been removed +- Enum `KnownLocationSpecProvisioningStatus` has been removed +- Enum `KnownLogFileTextSettingsRecordStartTimestampFormat` has been removed +- Enum `KnownLogFilesDataSourceFormat` has been removed +- Enum `KnownPerfCounterDataSourceStreams` has been removed +- Enum `KnownPrometheusForwarderDataSourceStreams` has been removed +- Enum `KnownPublicNetworkAccessOptions` has been removed +- Enum `KnownSyslogDataSourceFacilityNames` has been removed +- Enum `KnownSyslogDataSourceLogLevels` has been removed +- Enum `KnownSyslogDataSourceStreams` has been removed +- Enum `KnownWindowsEventLogDataSourceStreams` has been removed +- Enum `MetricAggregationType` has been removed +- Enum `MetricClass` has been removed +- Enum `MetricResultType` has been removed +- Enum `MetricStatisticType` has been removed +- Enum `MetricUnit` has been removed +- Enum `NamespaceClassification` has been removed +- Enum `Odatatype` has been removed +- Enum `OnboardingStatus` has been removed +- Enum `Operator` has been removed +- Enum `Origin` has been removed +- Enum `PredictiveAutoscalePolicyScaleMode` has been removed +- Enum `PrivateEndpointConnectionProvisioningState` has been removed +- Enum `PrivateEndpointServiceConnectionStatus` has been removed +- Enum `ProvisioningState` has been removed +- Enum `PublicNetworkAccess` has been removed +- Enum `RecurrenceFrequency` has been removed +- Enum `ResultType` has been removed +- Enum `ScaleDirection` has been removed +- Enum `ScaleRuleMetricDimensionOperationType` has been removed +- Enum `ScaleType` has been removed +- Enum `TimeAggregationOperator` has been removed +- Enum `TimeAggregationType` has been removed +- Enum `Unit` has been removed +- Function `NewActivityLogAlertsClient` has been removed +- Function `*ActivityLogAlertsClient.CreateOrUpdate` has been removed +- Function `*ActivityLogAlertsClient.Delete` has been removed +- Function `*ActivityLogAlertsClient.Get` has been removed +- Function `*ActivityLogAlertsClient.NewListByResourceGroupPager` has been removed +- Function `*ActivityLogAlertsClient.NewListBySubscriptionIDPager` has been removed +- Function `*ActivityLogAlertsClient.Update` has been removed +- Function `NewActivityLogsClient` has been removed +- Function `*ActivityLogsClient.NewListPager` has been removed +- Function `NewAlertRuleIncidentsClient` has been removed +- Function `*AlertRuleIncidentsClient.Get` has been removed +- Function `*AlertRuleIncidentsClient.NewListByAlertRulePager` has been removed +- Function `NewAlertRulesClient` has been removed +- Function `*AlertRulesClient.CreateOrUpdate` has been removed +- Function `*AlertRulesClient.Delete` has been removed +- Function `*AlertRulesClient.Get` has been removed +- Function `*AlertRulesClient.NewListByResourceGroupPager` has been removed +- Function `*AlertRulesClient.NewListBySubscriptionPager` has been removed +- Function `*AlertRulesClient.Update` has been removed +- Function `NewAutoscaleSettingsClient` has been removed +- Function `*AutoscaleSettingsClient.CreateOrUpdate` has been removed +- Function `*AutoscaleSettingsClient.Delete` has been removed +- Function `*AutoscaleSettingsClient.Get` has been removed +- Function `*AutoscaleSettingsClient.NewListByResourceGroupPager` has been removed +- Function `*AutoscaleSettingsClient.NewListBySubscriptionPager` has been removed +- Function `*AutoscaleSettingsClient.Update` has been removed +- Function `NewAzureMonitorWorkspacesClient` has been removed +- Function `*AzureMonitorWorkspacesClient.Create` has been removed +- Function `*AzureMonitorWorkspacesClient.Delete` has been removed +- Function `*AzureMonitorWorkspacesClient.Get` has been removed +- Function `*AzureMonitorWorkspacesClient.NewListByResourceGroupPager` has been removed +- Function `*AzureMonitorWorkspacesClient.NewListBySubscriptionPager` has been removed +- Function `*AzureMonitorWorkspacesClient.Update` has been removed +- Function `NewBaselinesClient` has been removed +- Function `*BaselinesClient.NewListPager` has been removed +- Function `*ClientFactory.NewActivityLogAlertsClient` has been removed +- Function `*ClientFactory.NewActivityLogsClient` has been removed +- Function `*ClientFactory.NewAlertRuleIncidentsClient` has been removed +- Function `*ClientFactory.NewAlertRulesClient` has been removed +- Function `*ClientFactory.NewAutoscaleSettingsClient` has been removed +- Function `*ClientFactory.NewAzureMonitorWorkspacesClient` has been removed +- Function `*ClientFactory.NewBaselinesClient` has been removed +- Function `*ClientFactory.NewDataCollectionEndpointsClient` has been removed +- Function `*ClientFactory.NewDataCollectionRuleAssociationsClient` has been removed +- Function `*ClientFactory.NewDataCollectionRulesClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsCategoryClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsClient` has been removed +- Function `*ClientFactory.NewEventCategoriesClient` has been removed +- Function `*ClientFactory.NewLogProfilesClient` has been removed +- Function `*ClientFactory.NewMetricAlertsClient` has been removed +- Function `*ClientFactory.NewMetricAlertsStatusClient` has been removed +- Function `*ClientFactory.NewMetricDefinitionsClient` has been removed +- Function `*ClientFactory.NewMetricNamespacesClient` has been removed +- Function `*ClientFactory.NewMetricsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewOperationsForMonitorClient` has been removed +- Function `*ClientFactory.NewPredictiveMetricClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionsClient` has been removed +- Function `*ClientFactory.NewPrivateLinkResourcesClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopeOperationStatusClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopedResourcesClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopesClient` has been removed +- Function `*ClientFactory.NewTenantActionGroupsClient` has been removed +- Function `*ClientFactory.NewTenantActivityLogsClient` has been removed +- Function `*ClientFactory.NewVMInsightsClient` has been removed +- Function `NewDataCollectionEndpointsClient` has been removed +- Function `*DataCollectionEndpointsClient.Create` has been removed +- Function `*DataCollectionEndpointsClient.Delete` has been removed +- Function `*DataCollectionEndpointsClient.Get` has been removed +- Function `*DataCollectionEndpointsClient.NewListByResourceGroupPager` has been removed +- Function `*DataCollectionEndpointsClient.NewListBySubscriptionPager` has been removed +- Function `*DataCollectionEndpointsClient.Update` has been removed +- Function `NewDataCollectionRuleAssociationsClient` has been removed +- Function `*DataCollectionRuleAssociationsClient.Create` has been removed +- Function `*DataCollectionRuleAssociationsClient.Delete` has been removed +- Function `*DataCollectionRuleAssociationsClient.Get` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByResourcePager` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByRulePager` has been removed +- Function `NewDataCollectionRulesClient` has been removed +- Function `*DataCollectionRulesClient.Create` has been removed +- Function `*DataCollectionRulesClient.Delete` has been removed +- Function `*DataCollectionRulesClient.Get` has been removed +- Function `*DataCollectionRulesClient.NewListByResourceGroupPager` has been removed +- Function `*DataCollectionRulesClient.NewListBySubscriptionPager` has been removed +- Function `*DataCollectionRulesClient.Update` has been removed +- Function `NewDiagnosticSettingsCategoryClient` has been removed +- Function `*DiagnosticSettingsCategoryClient.Get` has been removed +- Function `*DiagnosticSettingsCategoryClient.NewListPager` has been removed +- Function `NewDiagnosticSettingsClient` has been removed +- Function `*DiagnosticSettingsClient.CreateOrUpdate` has been removed +- Function `*DiagnosticSettingsClient.Delete` has been removed +- Function `*DiagnosticSettingsClient.Get` has been removed +- Function `*DiagnosticSettingsClient.NewListPager` has been removed +- Function `*DynamicMetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewEventCategoriesClient` has been removed +- Function `*EventCategoriesClient.NewListPager` has been removed +- Function `*LocationThresholdRuleCondition.GetRuleCondition` has been removed +- Function `NewLogProfilesClient` has been removed +- Function `*LogProfilesClient.CreateOrUpdate` has been removed +- Function `*LogProfilesClient.Delete` has been removed +- Function `*LogProfilesClient.Get` has been removed +- Function `*LogProfilesClient.NewListPager` has been removed +- Function `*LogProfilesClient.Update` has been removed +- Function `*ManagementEventRuleCondition.GetRuleCondition` has been removed +- Function `*MetricAlertCriteria.GetMetricAlertCriteria` has been removed +- Function `*MetricAlertMultipleResourceMultipleMetricCriteria.GetMetricAlertCriteria` has been removed +- Function `*MetricAlertSingleResourceMultipleMetricCriteria.GetMetricAlertCriteria` has been removed +- Function `NewMetricAlertsClient` has been removed +- Function `*MetricAlertsClient.CreateOrUpdate` has been removed +- Function `*MetricAlertsClient.Delete` has been removed +- Function `*MetricAlertsClient.Get` has been removed +- Function `*MetricAlertsClient.NewListByResourceGroupPager` has been removed +- Function `*MetricAlertsClient.NewListBySubscriptionPager` has been removed +- Function `*MetricAlertsClient.Update` has been removed +- Function `NewMetricAlertsStatusClient` has been removed +- Function `*MetricAlertsStatusClient.List` has been removed +- Function `*MetricAlertsStatusClient.ListByName` has been removed +- Function `*MetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewMetricDefinitionsClient` has been removed +- Function `*MetricDefinitionsClient.NewListAtSubscriptionScopePager` has been removed +- Function `*MetricDefinitionsClient.NewListPager` has been removed +- Function `NewMetricNamespacesClient` has been removed +- Function `*MetricNamespacesClient.NewListPager` has been removed +- Function `NewMetricsClient` has been removed +- Function `*MetricsClient.List` has been removed +- Function `*MetricsClient.ListAtSubscriptionScope` has been removed +- Function `*MetricsClient.ListAtSubscriptionScopePost` has been removed +- Function `*MultiMetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.List` has been removed +- Function `NewOperationsForMonitorClient` has been removed +- Function `*OperationsForMonitorClient.NewListPager` has been removed +- Function `PossibleAggregationTypeValues` has been removed +- Function `NewPredictiveMetricClient` has been removed +- Function `*PredictiveMetricClient.Get` has been removed +- Function `NewPrivateEndpointConnectionsClient` has been removed +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` has been removed +- Function `*PrivateEndpointConnectionsClient.BeginDelete` has been removed +- Function `*PrivateEndpointConnectionsClient.Get` has been removed +- Function `*PrivateEndpointConnectionsClient.ListByPrivateLinkScope` has been removed +- Function `NewPrivateLinkResourcesClient` has been removed +- Function `*PrivateLinkResourcesClient.Get` has been removed +- Function `*PrivateLinkResourcesClient.ListByPrivateLinkScope` has been removed +- Function `NewPrivateLinkScopeOperationStatusClient` has been removed +- Function `*PrivateLinkScopeOperationStatusClient.Get` has been removed +- Function `NewPrivateLinkScopedResourcesClient` has been removed +- Function `*PrivateLinkScopedResourcesClient.BeginCreateOrUpdate` has been removed +- Function `*PrivateLinkScopedResourcesClient.BeginDelete` has been removed +- Function `*PrivateLinkScopedResourcesClient.Get` has been removed +- Function `*PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager` has been removed +- Function `NewPrivateLinkScopesClient` has been removed +- Function `*PrivateLinkScopesClient.CreateOrUpdate` has been removed +- Function `*PrivateLinkScopesClient.BeginDelete` has been removed +- Function `*PrivateLinkScopesClient.Get` has been removed +- Function `*PrivateLinkScopesClient.NewListByResourceGroupPager` has been removed +- Function `*PrivateLinkScopesClient.NewListPager` has been removed +- Function `*PrivateLinkScopesClient.UpdateTags` has been removed +- Function `*RuleAction.GetRuleAction` has been removed +- Function `*RuleCondition.GetRuleCondition` has been removed +- Function `*RuleDataSource.GetRuleDataSource` has been removed +- Function `*RuleEmailAction.GetRuleAction` has been removed +- Function `*RuleManagementEventDataSource.GetRuleDataSource` has been removed +- Function `*RuleMetricDataSource.GetRuleDataSource` has been removed +- Function `*RuleWebhookAction.GetRuleAction` has been removed +- Function `NewTenantActionGroupsClient` has been removed +- Function `*TenantActionGroupsClient.CreateOrUpdate` has been removed +- Function `*TenantActionGroupsClient.Delete` has been removed +- Function `*TenantActionGroupsClient.Get` has been removed +- Function `*TenantActionGroupsClient.NewListByManagementGroupIDPager` has been removed +- Function `*TenantActionGroupsClient.Update` has been removed +- Function `NewTenantActivityLogsClient` has been removed +- Function `*TenantActivityLogsClient.NewListPager` has been removed +- Function `*ThresholdRuleCondition.GetRuleCondition` has been removed +- Function `NewVMInsightsClient` has been removed +- Function `*VMInsightsClient.GetOnboardingStatus` has been removed +- Function `*WebtestLocationAvailabilityCriteria.GetMetricAlertCriteria` has been removed +- Struct `AccessModeSettings` has been removed +- Struct `AccessModeSettingsExclusion` has been removed +- Struct `ActionGroupAutoGenerated` has been removed +- Struct `ActionGroupPatchAutoGenerated` has been removed +- Struct `ActionGroupPatchBodyAutoGenerated` has been removed +- Struct `ActionList` has been removed +- Struct `ActivityLogAlertResource` has been removed +- Struct `AlertRule` has been removed +- Struct `AlertRuleAllOfCondition` has been removed +- Struct `AlertRuleAnyOfOrLeafCondition` has been removed +- Struct `AlertRuleLeafCondition` has been removed +- Struct `AlertRuleList` has been removed +- Struct `AlertRulePatchObject` has been removed +- Struct `AlertRulePatchProperties` has been removed +- Struct `AlertRuleProperties` has been removed +- Struct `AlertRuleResource` has been removed +- Struct `AlertRuleResourceCollection` has been removed +- Struct `AlertRuleResourcePatch` has been removed +- Struct `AutoscaleErrorResponse` has been removed +- Struct `AutoscaleErrorResponseError` has been removed +- Struct `AutoscaleNotification` has been removed +- Struct `AutoscaleProfile` has been removed +- Struct `AutoscaleSetting` has been removed +- Struct `AutoscaleSettingResource` has been removed +- Struct `AutoscaleSettingResourceCollection` has been removed +- Struct `AutoscaleSettingResourcePatch` has been removed +- Struct `AzureAppPushReceiverAutoGenerated` has been removed +- Struct `AzureMonitorMetricsDestination` has been removed +- Struct `AzureMonitorPrivateLinkScope` has been removed +- Struct `AzureMonitorPrivateLinkScopeListResult` has been removed +- Struct `AzureMonitorPrivateLinkScopeProperties` has been removed +- Struct `AzureMonitorWorkspace` has been removed +- Struct `AzureMonitorWorkspaceDefaultIngestionSettings` has been removed +- Struct `AzureMonitorWorkspaceMetrics` has been removed +- Struct `AzureMonitorWorkspaceResource` has been removed +- Struct `AzureMonitorWorkspaceResourceForUpdate` has been removed +- Struct `AzureMonitorWorkspaceResourceListResult` has been removed +- Struct `AzureMonitorWorkspaceResourceProperties` has been removed +- Struct `AzureResourceAutoGenerated` has been removed +- Struct `BaselineMetadata` has been removed +- Struct `ColumnDefinition` has been removed +- Struct `ConfigurationAccessEndpointSpec` has been removed +- Struct `DataCollectionEndpoint` has been removed +- Struct `DataCollectionEndpointConfigurationAccess` has been removed +- Struct `DataCollectionEndpointFailoverConfiguration` has been removed +- Struct `DataCollectionEndpointLogsIngestion` has been removed +- Struct `DataCollectionEndpointMetadata` has been removed +- Struct `DataCollectionEndpointMetricsIngestion` has been removed +- Struct `DataCollectionEndpointNetworkACLs` has been removed +- Struct `DataCollectionEndpointResource` has been removed +- Struct `DataCollectionEndpointResourceIdentity` has been removed +- Struct `DataCollectionEndpointResourceListResult` has been removed +- Struct `DataCollectionEndpointResourceProperties` has been removed +- Struct `DataCollectionEndpointResourceSystemData` has been removed +- Struct `DataCollectionRule` has been removed +- Struct `DataCollectionRuleAssociation` has been removed +- Struct `DataCollectionRuleAssociationMetadata` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResource` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceListResult` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceProperties` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceSystemData` has been removed +- Struct `DataCollectionRuleDataSources` has been removed +- Struct `DataCollectionRuleDestinations` has been removed +- Struct `DataCollectionRuleMetadata` has been removed +- Struct `DataCollectionRuleResource` has been removed +- Struct `DataCollectionRuleResourceIdentity` has been removed +- Struct `DataCollectionRuleResourceListResult` has been removed +- Struct `DataCollectionRuleResourceProperties` has been removed +- Struct `DataCollectionRuleResourceSystemData` has been removed +- Struct `DataContainer` has been removed +- Struct `DataFlow` has been removed +- Struct `DataImportSources` has been removed +- Struct `DataImportSourcesEventHub` has been removed +- Struct `DataSourcesSpec` has been removed +- Struct `DataSourcesSpecDataImports` has been removed +- Struct `DefaultErrorResponse` has been removed +- Struct `DestinationsSpec` has been removed +- Struct `DestinationsSpecAzureMonitorMetrics` has been removed +- Struct `DiagnosticSettings` has been removed +- Struct `DiagnosticSettingsCategory` has been removed +- Struct `DiagnosticSettingsCategoryResource` has been removed +- Struct `DiagnosticSettingsCategoryResourceCollection` has been removed +- Struct `DiagnosticSettingsResource` has been removed +- Struct `DiagnosticSettingsResourceCollection` has been removed +- Struct `DynamicMetricCriteria` has been removed +- Struct `DynamicThresholdFailingPeriods` has been removed +- Struct `EmailNotification` has been removed +- Struct `EmailReceiverAutoGenerated` has been removed +- Struct `Error` has been removed +- Struct `ErrorContractAutoGenerated` has been removed +- Struct `ErrorDetail` has been removed +- Struct `ErrorDetailAutoGenerated` has been removed +- Struct `ErrorResponseAdditionalInfo` has been removed +- Struct `ErrorResponseAutoGenerated2` has been removed +- Struct `ErrorResponseCommonV2` has been removed +- Struct `ErrorResponseDetails` has been removed +- Struct `EventCategoryCollection` has been removed +- Struct `EventData` has been removed +- Struct `EventDataCollection` has been removed +- Struct `EventHubDataSource` has been removed +- Struct `EventHubDestination` has been removed +- Struct `EventHubDirectDestination` has been removed +- Struct `ExtensionDataSource` has been removed +- Struct `FailoverConfigurationSpec` has been removed +- Struct `HTTPRequestInfo` has been removed +- Struct `IisLogsDataSource` has been removed +- Struct `Incident` has been removed +- Struct `IncidentListResult` has been removed +- Struct `IngestionSettings` has been removed +- Struct `LocalizableString` has been removed +- Struct `LocationSpec` has been removed +- Struct `LocationThresholdRuleCondition` has been removed +- Struct `LogAnalyticsDestination` has been removed +- Struct `LogFileSettings` has been removed +- Struct `LogFileSettingsText` has been removed +- Struct `LogFileTextSettings` has been removed +- Struct `LogFilesDataSource` has been removed +- Struct `LogFilesDataSourceSettings` has been removed +- Struct `LogProfileCollection` has been removed +- Struct `LogProfileProperties` has been removed +- Struct `LogProfileResource` has been removed +- Struct `LogProfileResourcePatch` has been removed +- Struct `LogSettings` has been removed +- Struct `LogsIngestionEndpointSpec` has been removed +- Struct `ManagementEventAggregationCondition` has been removed +- Struct `ManagementEventRuleCondition` has been removed +- Struct `Metadata` has been removed +- Struct `MetadataValue` has been removed +- Struct `Metric` has been removed +- Struct `MetricAlertAction` has been removed +- Struct `MetricAlertMultipleResourceMultipleMetricCriteria` has been removed +- Struct `MetricAlertProperties` has been removed +- Struct `MetricAlertPropertiesPatch` has been removed +- Struct `MetricAlertResource` has been removed +- Struct `MetricAlertResourceCollection` has been removed +- Struct `MetricAlertResourcePatch` has been removed +- Struct `MetricAlertSingleResourceMultipleMetricCriteria` has been removed +- Struct `MetricAlertStatus` has been removed +- Struct `MetricAlertStatusCollection` has been removed +- Struct `MetricAlertStatusProperties` has been removed +- Struct `MetricAvailability` has been removed +- Struct `MetricBaselinesProperties` has been removed +- Struct `MetricBaselinesResponse` has been removed +- Struct `MetricCriteria` has been removed +- Struct `MetricDefinition` has been removed +- Struct `MetricDefinitionCollection` has been removed +- Struct `MetricDimension` has been removed +- Struct `MetricNamespace` has been removed +- Struct `MetricNamespaceCollection` has been removed +- Struct `MetricNamespaceName` has been removed +- Struct `MetricSettings` has been removed +- Struct `MetricSingleDimension` has been removed +- Struct `MetricTrigger` has been removed +- Struct `MetricValue` has been removed +- Struct `Metrics` has been removed +- Struct `MetricsIngestionEndpointSpec` has been removed +- Struct `MonitoringAccountDestination` has been removed +- Struct `NetworkRuleSet` has been removed +- Struct `Operation` has been removed +- Struct `OperationAutoGenerated` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationDisplayAutoGenerated` has been removed +- Struct `OperationListResult` has been removed +- Struct `OperationListResultAutoGenerated` has been removed +- Struct `OperationStatus` has been removed +- Struct `PerfCounterDataSource` has been removed +- Struct `PlatformTelemetryDataSource` has been removed +- Struct `PredictiveAutoscalePolicy` has been removed +- Struct `PredictiveResponse` has been removed +- Struct `PredictiveValue` has been removed +- Struct `PrivateEndpoint` has been removed +- Struct `PrivateEndpointConnection` has been removed +- Struct `PrivateEndpointConnectionListResult` has been removed +- Struct `PrivateEndpointConnectionProperties` has been removed +- Struct `PrivateLinkResource` has been removed +- Struct `PrivateLinkResourceListResult` has been removed +- Struct `PrivateLinkResourceProperties` has been removed +- Struct `PrivateLinkScopedResource` has been removed +- Struct `PrivateLinkServiceConnectionState` has been removed +- Struct `PrometheusForwarderDataSource` has been removed +- Struct `ProxyResource` has been removed +- Struct `ProxyResourceAutoGenerated` has been removed +- Struct `Recurrence` has been removed +- Struct `RecurrentSchedule` has been removed +- Struct `Resource` has been removed +- Struct `ResourceAutoGenerated` has been removed +- Struct `ResourceAutoGenerated2` has been removed +- Struct `ResourceAutoGenerated3` has been removed +- Struct `ResourceAutoGenerated4` has been removed +- Struct `ResourceAutoGenerated5` has been removed +- Struct `ResourceForUpdate` has been removed +- Struct `ResourceForUpdateIdentity` has been removed +- Struct `Response` has been removed +- Struct `ResponseWithError` has been removed +- Struct `RetentionPolicy` has been removed +- Struct `RuleEmailAction` has been removed +- Struct `RuleManagementEventClaimsDataSource` has been removed +- Struct `RuleManagementEventDataSource` has been removed +- Struct `RuleMetricDataSource` has been removed +- Struct `RuleWebhookAction` has been removed +- Struct `ScaleAction` has been removed +- Struct `ScaleCapacity` has been removed +- Struct `ScaleRule` has been removed +- Struct `ScaleRuleMetricDimension` has been removed +- Struct `ScopedResource` has been removed +- Struct `ScopedResourceListResult` has been removed +- Struct `ScopedResourceProperties` has been removed +- Struct `SenderAuthorization` has been removed +- Struct `SingleBaseline` has been removed +- Struct `SingleMetricBaseline` has been removed +- Struct `SmsReceiverAutoGenerated` has been removed +- Struct `StorageBlobDestination` has been removed +- Struct `StorageTableDestination` has been removed +- Struct `StreamDeclaration` has been removed +- Struct `SubscriptionScopeMetric` has been removed +- Struct `SubscriptionScopeMetricDefinition` has been removed +- Struct `SubscriptionScopeMetricDefinitionCollection` has been removed +- Struct `SubscriptionScopeMetricResponse` has been removed +- Struct `SubscriptionScopeMetricsRequestBodyParameters` has been removed +- Struct `SyslogDataSource` has been removed +- Struct `TagsResource` has been removed +- Struct `TenantActionGroup` has been removed +- Struct `TenantActionGroupList` has been removed +- Struct `TenantActionGroupResource` has been removed +- Struct `ThresholdRuleCondition` has been removed +- Struct `TimeSeriesBaseline` has been removed +- Struct `TimeSeriesElement` has been removed +- Struct `TimeWindow` has been removed +- Struct `TrackedResource` has been removed +- Struct `TrackedResourceAutoGenerated` has been removed +- Struct `VMInsightsOnboardingStatus` has been removed +- Struct `VMInsightsOnboardingStatusProperties` has been removed +- Struct `VoiceReceiverAutoGenerated` has been removed +- Struct `WebhookNotification` has been removed +- Struct `WebhookReceiverAutoGenerated` has been removed +- Struct `WebtestLocationAvailabilityCriteria` has been removed +- Struct `WindowsEventLogDataSource` has been removed +- Struct `WindowsFirewallLogsDataSource` has been removed +- Struct `WorkspaceInfo` has been removed +- Struct `WorkspaceInfoProperties` has been removed +- Field `PublicNetworkAccess`, `RuleResolveConfiguration` of struct `ScheduledQueryRuleProperties` has been removed + +### Features Added + +- New value `ConditionOperatorGreaterOrLessThan` added to enum type `ConditionOperator` +- New value `KindSimpleLogAlert` added to enum type `Kind` +- New enum type `IncidentManagementService` with values `IncidentManagementServiceIcm` +- New struct `IncidentReceiver` +- New struct `IncidentServiceConnection` +- New field `IncidentReceivers` in struct `ActionGroup` +- New field `Identity` in struct `ActionGroupPatchBody` +- New field `Identity` in struct `ActionGroupResource` +- New field `ActionProperties` in struct `Actions` +- New field `ManagedIdentity` in struct `AutomationRunbookReceiver` +- New field `ManagedIdentity` in struct `AzureFunctionReceiver` +- New field `Identity` in struct `AzureResource` +- New field `AlertSensitivity`, `CriterionType`, `IgnoreDataBefore`, `MinRecurrenceCount` in struct `Condition` +- New field `AdditionalInfo`, `Details`, `Target` in struct `ErrorResponseAutoGenerated` +- New field `ManagedIdentity` in struct `EventHubReceiver` +- New field `ManagedIdentity` in struct `LogicAppReceiver` +- New field `IncidentReceivers` in struct `NotificationRequestBody` +- New field `ResolveConfiguration` in struct `ScheduledQueryRuleProperties` +- New field `ManagedIdentity` in struct `WebhookReceiver` + + ## 0.11.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/monitor/armmonitor/README.md b/sdk/resourcemanager/monitor/armmonitor/README.md index 5031a70ca062..a1c9738f03e5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/README.md +++ b/sdk/resourcemanager/monitor/armmonitor/README.md @@ -55,7 +55,7 @@ clientFactory, err := armmonitor.NewClientFactory(, cred, &opti A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewAlertRuleIncidentsClient() +client := clientFactory.NewActionGroupsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go index c5d4fc18bd19..af42675d458c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationRequest - The notification request body which includes the contact details @@ -73,7 +70,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceL // CreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*http.Response, error) { var err error const operationName = "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel" @@ -96,7 +93,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel( } // createNotificationsAtActionGroupResourceLevelCreateRequest creates the CreateNotificationsAtActionGroupResourceLevel request. -func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, _ *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/createNotifications" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, notificationRequest); err != nil { @@ -127,7 +124,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC // CreateOrUpdate - Create a new action group or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - actionGroup - The action group to create or use for the update. @@ -156,7 +153,7 @@ func (client *ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource, options *ActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource, _ *ActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -175,7 +172,7 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { @@ -196,7 +193,7 @@ func (client *ActionGroupsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. @@ -222,7 +219,7 @@ func (client *ActionGroupsClient) Delete(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, _ *ActionGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -241,7 +238,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +248,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou // operation is only supported for Email or SMS receivers. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - enableRequest - The receiver to re-enable. @@ -279,7 +276,7 @@ func (client *ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGr } // enableReceiverCreateRequest creates the EnableReceiver request. -func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest, options *ActionGroupsClientEnableReceiverOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest, _ *ActionGroupsClientEnableReceiverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -298,7 +295,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, enableRequest); err != nil { @@ -310,7 +307,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex // Get - Get an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. @@ -337,7 +334,7 @@ func (client *ActionGroupsClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientGetOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, _ *ActionGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -356,7 +353,7 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,7 +371,7 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action // GetTestNotificationsAtActionGroupResourceLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationID - The notification id @@ -403,7 +400,7 @@ func (client *ActionGroupsClient) GetTestNotificationsAtActionGroupResourceLevel } // getTestNotificationsAtActionGroupResourceLevelCreateRequest creates the GetTestNotificationsAtActionGroupResourceLevel request. -func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, options *ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, _ *ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/notificationStatus/{notificationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,7 +423,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +440,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel // NewListByResourceGroupPager - Get a list of all action groups in a resource group. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager // method. @@ -472,7 +469,7 @@ func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -487,7 +484,7 @@ func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +501,7 @@ func (client *ActionGroupsClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionIDPager - Get a list of all action groups in a subscription. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager // method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { @@ -532,7 +529,7 @@ func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGr } // listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. -func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *ActionGroupsClientListBySubscriptionIDOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context.Context, _ *ActionGroupsClientListBySubscriptionIDOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -543,7 +540,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -561,7 +558,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. // Update - Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - actionGroupPatch - Parameters supplied to the operation. @@ -589,7 +586,7 @@ func (client *ActionGroupsClient) Update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody, options *ActionGroupsClientUpdateOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody, _ *ActionGroupsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -608,7 +605,7 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroupPatch); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go deleted file mode 100644 index 1c00a65a8bdc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ /dev/null @@ -1,938 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/createOrUpdateActionGroup.json -func ExampleActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().CreateOrUpdate(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.ActionGroup{ - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("Sample armRole"), - RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - UseCommonAlertSchema: to.Ptr(true), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr(""), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - GroupShortName: to.Ptr("sample"), - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // { - // Name: to.Ptr("Sample armRole"), - // RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // { - // Name: to.Ptr("testRunbook"), - // AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - // IsGlobalRunbook: to.Ptr(false), - // RunbookName: to.Ptr("Sample runbook"), - // ServiceURI: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - // }}, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // { - // Name: to.Ptr("Sample azureAppPush"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // }}, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // { - // Name: to.Ptr("Sample azureFunction"), - // FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - // FunctionName: to.Ptr("HttpTriggerCSharp1"), - // HTTPTriggerURL: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // { - // Name: to.Ptr("Sample eventHub"), - // EventHubName: to.Ptr("testEventHub"), - // EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - // SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // { - // Name: to.Ptr("Sample itsm"), - // ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - // Region: to.Ptr("westcentralus"), - // TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - // WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - // }}, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // { - // Name: to.Ptr("Sample logicApp"), - // CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - // ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getActionGroup.json -func ExampleActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Get(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/deleteActionGroup.json -func ExampleActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().Delete(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/patchActionGroup.json -func ExampleActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Update(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupPatchBody{ - Properties: &armmonitor.ActionGroupPatch{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/postTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_BeginCreateNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActionGroupsClient().BeginCreateNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", armmonitor.NotificationRequestBody{ - AlertType: to.Ptr("budget"), - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("ArmRole-Common"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("ArmRole-nonCommon"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(false), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-Name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_GetTestNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().GetTestNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/listActionGroups.json -func ExampleActionGroupsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActionGroupsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ActionGroupList = armmonitor.ActionGroupList{ - // Value: []*armmonitor.ActionGroupResource{ - // { - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SampleActionGroup2"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample2"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/enableReceiver.json -func ExampleActionGroupsClient_EnableReceiver() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().EnableReceiver(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.EnableRequest{ - ReceiverName: to.Ptr("John Doe's mobile"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go deleted file mode 100644 index 73bf59a32024..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go +++ /dev/null @@ -1,418 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ActivityLogAlertsClient contains the methods for the ActivityLogAlerts group. -// Don't use this type directly, use NewActivityLogAlertsClient() instead. -type ActivityLogAlertsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogAlertsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ActivityLogAlertsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a new Activity Log Alert rule or update an existing one. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - activityLogAlertRule - The Activity Log Alert rule to create or use for the update. -// - options - ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate -// method. -func (client *ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, options *ActivityLogAlertsClientCreateOrUpdateOptions) (ActivityLogAlertsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRule, options) - if err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ActivityLogAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, options *ActivityLogAlertsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, activityLogAlertRule); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ActivityLogAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (ActivityLogAlertsClientCreateOrUpdateResponse, error) { - result := ActivityLogAlertsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an Activity Log Alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - options - ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete -// method. -func (client *ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientDeleteOptions) (ActivityLogAlertsClientDeleteResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) - if err != nil { - return ActivityLogAlertsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientDeleteResponse{}, err - } - return ActivityLogAlertsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ActivityLogAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get an Activity Log Alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - options - ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. -func (client *ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientGetOptions) (ActivityLogAlertsClientGetResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) - if err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ActivityLogAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ActivityLogAlertsClient) getHandleResponse(resp *http.Response) (ActivityLogAlertsClientGetResponse, error) { - result := ActivityLogAlertsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Get a list of all Activity Log Alert rules in a resource group. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager -// method. -func (client *ActivityLogAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActivityLogAlertsClientListByResourceGroupOptions) *runtime.Pager[ActivityLogAlertsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListByResourceGroupResponse]{ - More: func(page ActivityLogAlertsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogAlertsClientListByResourceGroupResponse) (ActivityLogAlertsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogAlertsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ActivityLogAlertsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ActivityLogAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ActivityLogAlertsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ActivityLogAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (ActivityLogAlertsClientListByResourceGroupResponse, error) { - result := ActivityLogAlertsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleList); err != nil { - return ActivityLogAlertsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionIDPager - Get a list of all Activity Log Alert rules in a subscription. -// -// Generated from API version 2020-10-01 -// - options - ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager -// method. -func (client *ActivityLogAlertsClient) NewListBySubscriptionIDPager(options *ActivityLogAlertsClientListBySubscriptionIDOptions) *runtime.Pager[ActivityLogAlertsClientListBySubscriptionIDResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListBySubscriptionIDResponse]{ - More: func(page ActivityLogAlertsClientListBySubscriptionIDResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogAlertsClientListBySubscriptionIDResponse) (ActivityLogAlertsClientListBySubscriptionIDResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogAlertsClient.NewListBySubscriptionIDPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionIDCreateRequest(ctx, options) - }, nil) - if err != nil { - return ActivityLogAlertsClientListBySubscriptionIDResponse{}, err - } - return client.listBySubscriptionIDHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. -func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *ActivityLogAlertsClientListBySubscriptionIDOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionIDHandleResponse handles the ListBySubscriptionID response. -func (client *ActivityLogAlertsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (ActivityLogAlertsClientListBySubscriptionIDResponse, error) { - result := ActivityLogAlertsClientListBySubscriptionIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleList); err != nil { - return ActivityLogAlertsClientListBySubscriptionIDResponse{}, err - } - return result, nil -} - -// Update - Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, -// and to enable or disable the Alert rule. To update other fields use CreateOrUpdate -// operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - activityLogAlertRulePatch - Parameters supplied to the operation. -// - options - ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update -// method. -func (client *ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, options *ActivityLogAlertsClientUpdateOptions) (ActivityLogAlertsClientUpdateResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRulePatch, options) - if err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ActivityLogAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, options *ActivityLogAlertsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, activityLogAlertRulePatch); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ActivityLogAlertsClient) updateHandleResponse(resp *http.Response) (ActivityLogAlertsClientUpdateResponse, error) { - result := ActivityLogAlertsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go deleted file mode 100644 index 200ad713e952..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ /dev/null @@ -1,611 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("Administrative"), - Field: to.Ptr("category"), - }, - { - Equals: to.Ptr("Error"), - Field: to.Ptr("level"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("Category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("Level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithAnyOfCondition", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - AnyOf: []*armmonitor.AlertRuleLeafCondition{ - { - Equals: to.Ptr("Incident"), - Field: to.Ptr("properties.incidentType"), - }, - { - Equals: to.Ptr("Maintenance"), - Field: to.Ptr("properties.incidentType"), - }}, - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithAnyOfCondition"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithAnyOfCondition"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // AnyOf: []*armmonitor.AlertRuleLeafCondition{ - // { - // Equals: to.Ptr("Incident"), - // Field: to.Ptr("properties.incidentType"), - // }, - // { - // Equals: to.Ptr("Maintenance"), - // Field: to.Ptr("properties.incidentType"), - // }}, - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithContainsAny() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithContainsAny", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - ContainsAny: []*string{ - to.Ptr("North Europe"), - to.Ptr("West Europe")}, - Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithContainsAny"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithContainsAny"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // ContainsAny: []*string{ - // to.Ptr("North Europe"), - // to.Ptr("West Europe")}, - // Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json -func ExampleActivityLogAlertsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json -func ExampleActivityLogAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActivityLogAlertsClient().Delete(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json -func ExampleActivityLogAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Update(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.AlertRulePatchObject{ - Properties: &armmonitor.AlertRulePatchProperties{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(false), - // Scopes: []*string{ - // to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json -func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json -func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go deleted file mode 100644 index 492b618e1a55..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ActivityLogsClient contains the methods for the ActivityLogs group. -// Don't use this type directly, use NewActivityLogsClient() instead. -type ActivityLogsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewActivityLogsClient creates a new instance of ActivityLogsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ActivityLogsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides the list of records from the activity logs. -// -// Generated from API version 2015-04-01 -// - filter - Reduces the set of data collected. -// This argument is required and it also requires at least the start date/time. -// The $filter argument is very restricted and allows only the following patterns. -// - List events for a resource group: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceGroupName eq 'resourceGroupName'. -// - List events for resource: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceUri eq 'resourceURI'. -// - List events for a subscription in a time range: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp -// le '2014-07-20T04:36:37.6407898Z'. -// - List events for a resource provider: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceProvider eq 'resourceProviderName'. -// - List events for a correlation Id: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and correlationId eq 'correlationID'. -// NOTE: No other syntax is allowed. -// - options - ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. -func (client *ActivityLogsClient) NewListPager(filter string, options *ActivityLogsClientListOptions) *runtime.Pager[ActivityLogsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogsClientListResponse]{ - More: func(page ActivityLogsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogsClientListResponse) (ActivityLogsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, filter, options) - }, nil) - if err != nil { - return ActivityLogsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ActivityLogsClient) listCreateRequest(ctx context.Context, filter string, options *ActivityLogsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - reqQP.Set("$filter", filter) - if options != nil && options.Select != nil { - reqQP.Set("$select", *options.Select) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ActivityLogsClient) listHandleResponse(resp *http.Response) (ActivityLogsClientListResponse, error) { - result := ActivityLogsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return ActivityLogsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go deleted file mode 100644 index f77fa9b69702..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go deleted file mode 100644 index caf0f7b0d2bb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AlertRuleIncidentsClient contains the methods for the AlertRuleIncidents group. -// Don't use this type directly, use NewAlertRuleIncidentsClient() instead. -type AlertRuleIncidentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleIncidentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertRuleIncidentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets an incident associated to an alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - incidentName - The name of the incident to retrieve. -// - options - AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. -func (client *AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (AlertRuleIncidentsClientGetResponse, error) { - var err error - const operationName = "AlertRuleIncidentsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, incidentName, options) - if err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertRuleIncidentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if incidentName == "" { - return nil, errors.New("parameter incidentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{incidentName}", url.PathEscape(incidentName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) (AlertRuleIncidentsClientGetResponse, error) { - result := AlertRuleIncidentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Incident); err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - return result, nil -} - -// NewListByAlertRulePager - Gets a list of incidents associated to an alert rule -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager -// method. -func (client *AlertRuleIncidentsClient) NewListByAlertRulePager(resourceGroupName string, ruleName string, options *AlertRuleIncidentsClientListByAlertRuleOptions) *runtime.Pager[AlertRuleIncidentsClientListByAlertRuleResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRuleIncidentsClientListByAlertRuleResponse]{ - More: func(page AlertRuleIncidentsClientListByAlertRuleResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRuleIncidentsClientListByAlertRuleResponse) (AlertRuleIncidentsClientListByAlertRuleResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRuleIncidentsClient.NewListByAlertRulePager") - req, err := client.listByAlertRuleCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, runtime.NewResponseError(resp) - } - return client.listByAlertRuleHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByAlertRuleCreateRequest creates the ListByAlertRule request. -func (client *AlertRuleIncidentsClient) listByAlertRuleCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRuleIncidentsClientListByAlertRuleOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByAlertRuleHandleResponse handles the ListByAlertRule response. -func (client *AlertRuleIncidentsClient) listByAlertRuleHandleResponse(resp *http.Response) (AlertRuleIncidentsClientListByAlertRuleResponse, error) { - result := AlertRuleIncidentsClientListByAlertRuleResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IncidentListResult); err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go deleted file mode 100644 index a7ea44b05299..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json -func ExampleAlertRuleIncidentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRuleIncidentsClient().Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Incident = armmonitor.Incident{ - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json -func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRuleIncidentsClient().NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IncidentListResult = armmonitor.IncidentListResult{ - // Value: []*armmonitor.Incident{ - // { - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go deleted file mode 100644 index e22582113f98..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AlertRulesClient contains the methods for the AlertRules group. -// Don't use this type directly, use NewAlertRulesClient() instead. -type AlertRulesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertRulesClient creates a new instance of AlertRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertRulesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a classic metric alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to create or update. -// - options - AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate -// method. -func (client *AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource, options *AlertRulesClientCreateOrUpdateOptions) (AlertRulesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AlertRulesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) - if err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AlertRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource, options *AlertRulesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response) (AlertRulesClientCreateOrUpdateResponse, error) { - result := AlertRulesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a classic metric alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. -func (client *AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientDeleteOptions) (AlertRulesClientDeleteResponse, error) { - var err error - const operationName = "AlertRulesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientDeleteResponse{}, err - } - return AlertRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a classic metric alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. -func (client *AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientGetOptions) (AlertRulesClientGetResponse, error) { - var err error - const operationName = "AlertRulesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AlertRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRulesClientGetResponse, error) { - result := AlertRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List the classic metric alert rules within a resource group. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager -// method. -func (client *AlertRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertRulesClientListByResourceGroupOptions) *runtime.Pager[AlertRulesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListByResourceGroupResponse]{ - More: func(page AlertRulesClientListByResourceGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRulesClientListByResourceGroupResponse) (AlertRulesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRulesClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRulesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AlertRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AlertRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AlertRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (AlertRulesClientListByResourceGroupResponse, error) { - result := AlertRulesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List the classic metric alert rules within a subscription. -// -// Generated from API version 2016-03-01 -// - options - AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager -// method. -func (client *AlertRulesClient) NewListBySubscriptionPager(options *AlertRulesClientListBySubscriptionOptions) *runtime.Pager[AlertRulesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListBySubscriptionResponse]{ - More: func(page AlertRulesClientListBySubscriptionResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRulesClientListBySubscriptionResponse) (AlertRulesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRulesClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, options) - if err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRulesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AlertRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AlertRulesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AlertRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (AlertRulesClientListBySubscriptionResponse, error) { - result := AlertRulesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - alertRulesResource - Parameters supplied to the operation. -// - options - AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. -func (client *AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch, options *AlertRulesClientUpdateOptions) (AlertRulesClientUpdateResponse, error) { - var err error - const operationName = "AlertRulesClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, ruleName, alertRulesResource, options) - if err != nil { - return AlertRulesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AlertRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch, options *AlertRulesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, alertRulesResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AlertRulesClient) updateHandleResponse(resp *http.Response) (AlertRulesClientUpdateResponse, error) { - result := AlertRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go deleted file mode 100644 index 653ea80a2dec..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteAlertRule.json -func ExampleAlertRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertRulesClient().Delete(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json -func ExampleAlertRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchAlertRule.json -func ExampleAlertRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Update(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResourcePatch{ - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - Tags: map[string]*string{ - "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRule.json -func ExampleAlertRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListByResourceGroupPager("Rac46PostSwapRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleBySubscription.json -func ExampleAlertRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 1a2805b6b7e6..f2ac75dbce9a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.11.0 +module-version: 0.12.0 ``` diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go deleted file mode 100644 index 771527125f21..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AutoscaleSettingsClient contains the methods for the AutoscaleSettings group. -// Don't use this type directly, use NewAutoscaleSettingsClient() instead. -type AutoscaleSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoscaleSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AutoscaleSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates an autoscale setting. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - parameters - Parameters supplied to the operation. -// - options - AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate -// method. -func (client *AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (AutoscaleSettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, autoscaleSettingName, parameters, options) - if err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AutoscaleSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (AutoscaleSettingsClientCreateOrUpdateResponse, error) { - result := AutoscaleSettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes and autoscale setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - options - AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete -// method. -func (client *AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (AutoscaleSettingsClientDeleteResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) - if err != nil { - return AutoscaleSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientDeleteResponse{}, err - } - return AutoscaleSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets an autoscale setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - options - AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. -func (client *AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (AutoscaleSettingsClientGetResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) - if err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (AutoscaleSettingsClientGetResponse, error) { - result := AutoscaleSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists the autoscale settings for a resource group -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager -// method. -func (client *AutoscaleSettingsClient) NewListByResourceGroupPager(resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) *runtime.Pager[AutoscaleSettingsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListByResourceGroupResponse]{ - More: func(page AutoscaleSettingsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutoscaleSettingsClientListByResourceGroupResponse) (AutoscaleSettingsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutoscaleSettingsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return AutoscaleSettingsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *http.Response) (AutoscaleSettingsClientListByResourceGroupResponse, error) { - result := AutoscaleSettingsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists the autoscale settings for a subscription -// -// Generated from API version 2022-10-01 -// - options - AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager -// method. -func (client *AutoscaleSettingsClient) NewListBySubscriptionPager(options *AutoscaleSettingsClientListBySubscriptionOptions) *runtime.Pager[AutoscaleSettingsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListBySubscriptionResponse]{ - More: func(page AutoscaleSettingsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutoscaleSettingsClientListBySubscriptionResponse) (AutoscaleSettingsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutoscaleSettingsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return AutoscaleSettingsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AutoscaleSettingsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AutoscaleSettingsClient) listBySubscriptionHandleResponse(resp *http.Response) (AutoscaleSettingsClientListBySubscriptionResponse, error) { - result := AutoscaleSettingsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - autoscaleSettingResource - Parameters supplied to the operation. -// - options - AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update -// method. -func (client *AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (AutoscaleSettingsClientUpdateResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options) - if err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, autoscaleSettingResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AutoscaleSettingsClient) updateHandleResponse(resp *http.Response) (AutoscaleSettingsClientUpdateResponse, error) { - result := AutoscaleSettingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go deleted file mode 100644 index af47a871e44d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ /dev/null @@ -1,1166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListByResourceGroupPager("TestingMetricsScaleSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().CreateOrUpdate(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAutoscaleSettingsClient().Delete(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Get(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Update(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResourcePatch{ - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json -func ExampleAutoscaleSettingsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go deleted file mode 100644 index d23375c62f44..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go +++ /dev/null @@ -1,419 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AzureMonitorWorkspacesClient contains the methods for the AzureMonitorWorkspaces group. -// Don't use this type directly, use NewAzureMonitorWorkspacesClient() instead. -type AzureMonitorWorkspacesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureMonitorWorkspacesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureMonitorWorkspacesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or update a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new workspace -// - options - AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create -// method. -func (client *AzureMonitorWorkspacesClient) Create(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (AzureMonitorWorkspacesClientCreateResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, options) - if err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AzureMonitorWorkspacesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureMonitorWorkspaceProperties); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AzureMonitorWorkspacesClient) createHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientCreateResponse, error) { - result := AzureMonitorWorkspacesClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete -// method. -func (client *AzureMonitorWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - return AzureMonitorWorkspacesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specific Azure Monitor workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get -// method. -func (client *AzureMonitorWorkspacesClient) Get(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (AzureMonitorWorkspacesClientGetResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AzureMonitorWorkspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AzureMonitorWorkspacesClient) getHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientGetResponse, error) { - result := AzureMonitorWorkspacesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all workspaces in the specified resource group -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager -// method. -func (client *AzureMonitorWorkspacesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) *runtime.Pager[AzureMonitorWorkspacesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListByResourceGroupResponse]{ - More: func(page AzureMonitorWorkspacesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListByResourceGroupResponse) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureMonitorWorkspacesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureMonitorWorkspacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AzureMonitorWorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { - result := AzureMonitorWorkspacesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { - return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all workspaces in the specified subscription -// -// Generated from API version 2021-06-03-preview -// - options - AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager -// method. -func (client *AzureMonitorWorkspacesClient) NewListBySubscriptionPager(options *AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListBySubscriptionResponse]{ - More: func(page AzureMonitorWorkspacesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListBySubscriptionResponse) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureMonitorWorkspacesClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureMonitorWorkspacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureMonitorWorkspacesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AzureMonitorWorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { - result := AzureMonitorWorkspacesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { - return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update -// method. -func (client *AzureMonitorWorkspacesClient) Update(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (AzureMonitorWorkspacesClientUpdateResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.AzureMonitorWorkspaceProperties != nil { - if err := runtime.MarshalAsJSON(req, *options.AzureMonitorWorkspaceProperties); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AzureMonitorWorkspacesClient) updateHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientUpdateResponse, error) { - result := AzureMonitorWorkspacesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go deleted file mode 100644 index 455a436b12cd..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go +++ /dev/null @@ -1,379 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json -func ExampleAzureMonitorWorkspacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-abcd.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herAzureMonitorWorkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListBySubscription.json -func ExampleAzureMonitorWorkspacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herazuremonitorworkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesGet.json -func ExampleAzureMonitorWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Get(ctx, "myResourceGroup", "myAzureMonitorWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesCreate.json -func ExampleAzureMonitorWorkspacesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Create(ctx, "myResourceGroup", "myAzureMonitorWorkspace", armmonitor.AzureMonitorWorkspaceResource{ - Location: to.Ptr("eastus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesUpdate.json -func ExampleAzureMonitorWorkspacesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Update(ctx, "myResourceGroup", "myAzureMonitorWorkspace", &armmonitor.AzureMonitorWorkspacesClientUpdateOptions{AzureMonitorWorkspaceProperties: &armmonitor.AzureMonitorWorkspaceResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesDelete.json -func ExampleAzureMonitorWorkspacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAzureMonitorWorkspacesClient().Delete(ctx, "myResourceGroup", "myAzureMonitorWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go deleted file mode 100644 index 997ba5b2a6a1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// BaselinesClient contains the methods for the Baselines group. -// Don't use this type directly, use NewBaselinesClient() instead. -type BaselinesClient struct { - internal *arm.Client -} - -// NewBaselinesClient creates a new instance of BaselinesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BaselinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BaselinesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric baseline values for a resource. -// -// Generated from API version 2019-03-01 -// - resourceURI - The identifier of the resource. -// - options - BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. -func (client *BaselinesClient) NewListPager(resourceURI string, options *BaselinesClientListOptions) *runtime.Pager[BaselinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BaselinesClientListResponse]{ - More: func(page BaselinesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *BaselinesClientListResponse) (BaselinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BaselinesClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return BaselinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BaselinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BaselinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BaselinesClient) listCreateRequest(ctx context.Context, resourceURI string, options *BaselinesClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricBaselines" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Sensitivities != nil { - reqQP.Set("sensitivities", *options.Sensitivities) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - reqQP.Set("api-version", "2019-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BaselinesClient) listHandleResponse(resp *http.Response) (BaselinesClientListResponse, error) { - result := BaselinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricBaselinesResponse); err != nil { - return BaselinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go deleted file mode 100644 index 7eb46f3d4253..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json -func ExampleBaselinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBaselinesClient().NewListPager("subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", &armmonitor.BaselinesClientListOptions{Metricnames: nil, - Metricnamespace: nil, - Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - Interval: to.Ptr("PT1H"), - Aggregation: to.Ptr("average"), - Sensitivities: to.Ptr("Low,Medium"), - Filter: nil, - ResultType: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricBaselinesResponse = armmonitor.MetricBaselinesResponse{ - // Value: []*armmonitor.SingleMetricBaseline{ - // { - // Name: to.Ptr("Percentage CPU"), - // Type: to.Ptr("microsoft.insights/metricBaselines"), - // ID: to.Ptr("/subscriptions/11aeb0ed-456b-4ca0-8df5-b9fbdc63d0d3/resourceGroups/SmartAnalytics-DEV-VM/providers/Microsoft.Compute/virtualMachines/DemoVM1/providers/microsoft.insights/metricBaselines/Percentage CPU"), - // Properties: &armmonitor.MetricBaselinesProperties{ - // Baselines: []*armmonitor.TimeSeriesBaseline{ - // { - // Aggregation: to.Ptr("average"), - // Data: []*armmonitor.SingleBaseline{ - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](90.3453), - // to.Ptr[float64](91.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](30), - // to.Ptr[float64](31.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityLow), - // }, - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](70.3453), - // to.Ptr[float64](71.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](50), - // to.Ptr[float64](51.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityMedium), - // }}, - // Dimensions: []*armmonitor.MetricSingleDimension{ - // }, - // MetadataValues: []*armmonitor.BaselineMetadata{ - // { - // Name: to.Ptr("ErrorType"), - // Value: to.Ptr("TooManyAnomalies"), - // }, - // { - // Name: to.Ptr("SeasonalityFrequency"), - // Value: to.Ptr("288"), - // }}, - // Timestamps: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T11:00:00.000Z"); return t}()), - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T12:00:00.000Z"); return t}())}, - // }}, - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/client_factory.go b/sdk/resourcemanager/monitor/armmonitor/client_factory.go index 06b2c0c10362..b2e65899f533 100644 --- a/sdk/resourcemanager/monitor/armmonitor/client_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -17,8 +14,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,204 +23,28 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewActionGroupsClient creates a new instance of ActionGroupsClient. func (c *ClientFactory) NewActionGroupsClient() *ActionGroupsClient { - subClient, _ := NewActionGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient. -func (c *ClientFactory) NewActivityLogAlertsClient() *ActivityLogAlertsClient { - subClient, _ := NewActivityLogAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewActivityLogsClient creates a new instance of ActivityLogsClient. -func (c *ClientFactory) NewActivityLogsClient() *ActivityLogsClient { - subClient, _ := NewActivityLogsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient. -func (c *ClientFactory) NewAlertRuleIncidentsClient() *AlertRuleIncidentsClient { - subClient, _ := NewAlertRuleIncidentsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAlertRulesClient creates a new instance of AlertRulesClient. -func (c *ClientFactory) NewAlertRulesClient() *AlertRulesClient { - subClient, _ := NewAlertRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient. -func (c *ClientFactory) NewAutoscaleSettingsClient() *AutoscaleSettingsClient { - subClient, _ := NewAutoscaleSettingsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient. -func (c *ClientFactory) NewAzureMonitorWorkspacesClient() *AzureMonitorWorkspacesClient { - subClient, _ := NewAzureMonitorWorkspacesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewBaselinesClient creates a new instance of BaselinesClient. -func (c *ClientFactory) NewBaselinesClient() *BaselinesClient { - subClient, _ := NewBaselinesClient(c.credential, c.options) - return subClient -} - -// NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient. -func (c *ClientFactory) NewDataCollectionEndpointsClient() *DataCollectionEndpointsClient { - subClient, _ := NewDataCollectionEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient. -func (c *ClientFactory) NewDataCollectionRuleAssociationsClient() *DataCollectionRuleAssociationsClient { - subClient, _ := NewDataCollectionRuleAssociationsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient. -func (c *ClientFactory) NewDataCollectionRulesClient() *DataCollectionRulesClient { - subClient, _ := NewDataCollectionRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient. -func (c *ClientFactory) NewDiagnosticSettingsCategoryClient() *DiagnosticSettingsCategoryClient { - subClient, _ := NewDiagnosticSettingsCategoryClient(c.credential, c.options) - return subClient -} - -// NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient. -func (c *ClientFactory) NewDiagnosticSettingsClient() *DiagnosticSettingsClient { - subClient, _ := NewDiagnosticSettingsClient(c.credential, c.options) - return subClient -} - -// NewEventCategoriesClient creates a new instance of EventCategoriesClient. -func (c *ClientFactory) NewEventCategoriesClient() *EventCategoriesClient { - subClient, _ := NewEventCategoriesClient(c.credential, c.options) - return subClient -} - -// NewLogProfilesClient creates a new instance of LogProfilesClient. -func (c *ClientFactory) NewLogProfilesClient() *LogProfilesClient { - subClient, _ := NewLogProfilesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricAlertsClient creates a new instance of MetricAlertsClient. -func (c *ClientFactory) NewMetricAlertsClient() *MetricAlertsClient { - subClient, _ := NewMetricAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient. -func (c *ClientFactory) NewMetricAlertsStatusClient() *MetricAlertsStatusClient { - subClient, _ := NewMetricAlertsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient. -func (c *ClientFactory) NewMetricDefinitionsClient() *MetricDefinitionsClient { - subClient, _ := NewMetricDefinitionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricNamespacesClient creates a new instance of MetricNamespacesClient. -func (c *ClientFactory) NewMetricNamespacesClient() *MetricNamespacesClient { - subClient, _ := NewMetricNamespacesClient(c.credential, c.options) - return subClient -} - -// NewMetricsClient creates a new instance of MetricsClient. -func (c *ClientFactory) NewMetricsClient() *MetricsClient { - subClient, _ := NewMetricsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - -// NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient. -func (c *ClientFactory) NewOperationsForMonitorClient() *OperationsForMonitorClient { - subClient, _ := NewOperationsForMonitorClient(c.credential, c.options) - return subClient -} - -// NewPredictiveMetricClient creates a new instance of PredictiveMetricClient. -func (c *ClientFactory) NewPredictiveMetricClient() *PredictiveMetricClient { - subClient, _ := NewPredictiveMetricClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient. -func (c *ClientFactory) NewPrivateLinkScopeOperationStatusClient() *PrivateLinkScopeOperationStatusClient { - subClient, _ := NewPrivateLinkScopeOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient. -func (c *ClientFactory) NewPrivateLinkScopedResourcesClient() *PrivateLinkScopedResourcesClient { - subClient, _ := NewPrivateLinkScopedResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient. -func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { - subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActionGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient. func (c *ClientFactory) NewScheduledQueryRulesClient() *ScheduledQueryRulesClient { - subClient, _ := NewScheduledQueryRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient. -func (c *ClientFactory) NewTenantActionGroupsClient() *TenantActionGroupsClient { - subClient, _ := NewTenantActionGroupsClient(c.credential, c.options) - return subClient -} - -// NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient. -func (c *ClientFactory) NewTenantActivityLogsClient() *TenantActivityLogsClient { - subClient, _ := NewTenantActivityLogsClient(c.credential, c.options) - return subClient -} - -// NewVMInsightsClient creates a new instance of VMInsightsClient. -func (c *ClientFactory) NewVMInsightsClient() *VMInsightsClient { - subClient, _ := NewVMInsightsClient(c.credential, c.options) - return subClient + return &ScheduledQueryRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 352de0354f9d..2786d2feede2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -10,85 +7,9 @@ package armmonitor const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - moduleVersion = "v0.11.0" -) - -// AccessMode - Access mode types. -type AccessMode string - -const ( - AccessModeOpen AccessMode = "Open" - AccessModePrivateOnly AccessMode = "PrivateOnly" -) - -// PossibleAccessModeValues returns the possible values for the AccessMode const type. -func PossibleAccessModeValues() []AccessMode { - return []AccessMode{ - AccessModeOpen, - AccessModePrivateOnly, - } -} - -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string - -const ( - ActionTypeInternal ActionType = "Internal" + moduleVersion = "v0.12.0" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - -// AggregationType - the aggregation type of the metric. -type AggregationType string - -const ( - AggregationTypeAverage AggregationType = "Average" - AggregationTypeCount AggregationType = "Count" - AggregationTypeMaximum AggregationType = "Maximum" - AggregationTypeMinimum AggregationType = "Minimum" - AggregationTypeNone AggregationType = "None" - AggregationTypeTotal AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns the possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{ - AggregationTypeAverage, - AggregationTypeCount, - AggregationTypeMaximum, - AggregationTypeMinimum, - AggregationTypeNone, - AggregationTypeTotal, - } -} - -// AggregationTypeEnum - the criteria time aggregation types. -type AggregationTypeEnum string - -const ( - AggregationTypeEnumAverage AggregationTypeEnum = "Average" - AggregationTypeEnumCount AggregationTypeEnum = "Count" - AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" - AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - AggregationTypeEnumTotal AggregationTypeEnum = "Total" -) - -// PossibleAggregationTypeEnumValues returns the possible values for the AggregationTypeEnum const type. -func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { - return []AggregationTypeEnum{ - AggregationTypeEnumAverage, - AggregationTypeEnumCount, - AggregationTypeEnumMaximum, - AggregationTypeEnumMinimum, - AggregationTypeEnumTotal, - } -} - // AlertSeverity - Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required // only for rules of the kind LogAlert. type AlertSeverity int64 @@ -112,69 +33,12 @@ func PossibleAlertSeverityValues() []AlertSeverity { } } -// BaselineSensitivity - the sensitivity of the baseline. -type BaselineSensitivity string - -const ( - BaselineSensitivityHigh BaselineSensitivity = "High" - BaselineSensitivityLow BaselineSensitivity = "Low" - BaselineSensitivityMedium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns the possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{ - BaselineSensitivityHigh, - BaselineSensitivityLow, - BaselineSensitivityMedium, - } -} - -// CategoryType - The type of the diagnostic settings category. -type CategoryType string - -const ( - CategoryTypeLogs CategoryType = "Logs" - CategoryTypeMetrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns the possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{ - CategoryTypeLogs, - CategoryTypeMetrics, - } -} - -// ComparisonOperationType - the operator that is used to compare the metric data and the threshold. -type ComparisonOperationType string - -const ( - ComparisonOperationTypeEquals ComparisonOperationType = "Equals" - ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" - ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns the possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{ - ComparisonOperationTypeEquals, - ComparisonOperationTypeGreaterThan, - ComparisonOperationTypeGreaterThanOrEqual, - ComparisonOperationTypeLessThan, - ComparisonOperationTypeLessThanOrEqual, - ComparisonOperationTypeNotEquals, - } -} - -// ConditionOperator - Operators allowed in the rule condition. +// ConditionOperator - The criteria operator. Relevant and required only for rules of the kind LogAlert. type ConditionOperator string const ( ConditionOperatorEquals ConditionOperator = "Equals" + ConditionOperatorGreaterOrLessThan ConditionOperator = "GreaterOrLessThan" ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" ConditionOperatorLessThan ConditionOperator = "LessThan" @@ -185,6 +49,7 @@ const ( func PossibleConditionOperatorValues() []ConditionOperator { return []ConditionOperator{ ConditionOperatorEquals, + ConditionOperatorGreaterOrLessThan, ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, @@ -228,23 +93,6 @@ func PossibleCriterionTypeValues() []CriterionType { } } -// DataStatus - The status of VM Insights data from the resource. When reported as present the data array will contain information -// about the data containers to which data for the specified resource is being routed. -type DataStatus string - -const ( - DataStatusNotPresent DataStatus = "notPresent" - DataStatusPresent DataStatus = "present" -) - -// PossibleDataStatusValues returns the possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{ - DataStatusNotPresent, - DataStatusPresent, - } -} - // DimensionOperator - Operator for dimension values type DimensionOperator string @@ -261,65 +109,6 @@ func PossibleDimensionOperatorValues() []DimensionOperator { } } -// DynamicThresholdOperator - The operator used to compare the metric value against the threshold. -type DynamicThresholdOperator string - -const ( - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns the possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{ - DynamicThresholdOperatorGreaterOrLessThan, - DynamicThresholdOperatorGreaterThan, - DynamicThresholdOperatorLessThan, - } -} - -// DynamicThresholdSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold -// is to the metric series pattern. -type DynamicThresholdSensitivity string - -const ( - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns the possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{ - DynamicThresholdSensitivityHigh, - DynamicThresholdSensitivityLow, - DynamicThresholdSensitivityMedium, - } -} - -// EventLevel - the event level -type EventLevel string - -const ( - EventLevelCritical EventLevel = "Critical" - EventLevelError EventLevel = "Error" - EventLevelInformational EventLevel = "Informational" - EventLevelVerbose EventLevel = "Verbose" - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns the possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{ - EventLevelCritical, - EventLevelError, - EventLevelInformational, - EventLevelVerbose, - EventLevelWarning, - } -} - // IdentityType - Type of managed service identity. type IdentityType string @@ -338,416 +127,35 @@ func PossibleIdentityTypeValues() []IdentityType { } } -// Kind - Indicates the type of scheduled query rule. The default is LogAlert. -type Kind string - -const ( - KindLogAlert Kind = "LogAlert" - KindLogToMetric Kind = "LogToMetric" -) - -// PossibleKindValues returns the possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{ - KindLogAlert, - KindLogToMetric, - } -} - -// KnownColumnDefinitionType - The type of the column data. -type KnownColumnDefinitionType string - -const ( - KnownColumnDefinitionTypeBoolean KnownColumnDefinitionType = "boolean" - KnownColumnDefinitionTypeDatetime KnownColumnDefinitionType = "datetime" - KnownColumnDefinitionTypeDynamic KnownColumnDefinitionType = "dynamic" - KnownColumnDefinitionTypeInt KnownColumnDefinitionType = "int" - KnownColumnDefinitionTypeLong KnownColumnDefinitionType = "long" - KnownColumnDefinitionTypeReal KnownColumnDefinitionType = "real" - KnownColumnDefinitionTypeString KnownColumnDefinitionType = "string" -) - -// PossibleKnownColumnDefinitionTypeValues returns the possible values for the KnownColumnDefinitionType const type. -func PossibleKnownColumnDefinitionTypeValues() []KnownColumnDefinitionType { - return []KnownColumnDefinitionType{ - KnownColumnDefinitionTypeBoolean, - KnownColumnDefinitionTypeDatetime, - KnownColumnDefinitionTypeDynamic, - KnownColumnDefinitionTypeInt, - KnownColumnDefinitionTypeLong, - KnownColumnDefinitionTypeReal, - KnownColumnDefinitionTypeString, - } -} - -// KnownDataCollectionEndpointProvisioningState - The resource provisioning state. This property is READ-ONLY. -type KnownDataCollectionEndpointProvisioningState string - -const ( - KnownDataCollectionEndpointProvisioningStateCanceled KnownDataCollectionEndpointProvisioningState = "Canceled" - KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" - KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" - KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" - KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" - KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionEndpointProvisioningStateValues returns the possible values for the KnownDataCollectionEndpointProvisioningState const type. -func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { - return []KnownDataCollectionEndpointProvisioningState{ - KnownDataCollectionEndpointProvisioningStateCanceled, - KnownDataCollectionEndpointProvisioningStateCreating, - KnownDataCollectionEndpointProvisioningStateDeleting, - KnownDataCollectionEndpointProvisioningStateFailed, - KnownDataCollectionEndpointProvisioningStateSucceeded, - KnownDataCollectionEndpointProvisioningStateUpdating, - } -} - -// KnownDataCollectionEndpointResourceKind - The kind of the resource. -type KnownDataCollectionEndpointResourceKind string - -const ( - KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" - KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" -) - -// PossibleKnownDataCollectionEndpointResourceKindValues returns the possible values for the KnownDataCollectionEndpointResourceKind const type. -func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { - return []KnownDataCollectionEndpointResourceKind{ - KnownDataCollectionEndpointResourceKindLinux, - KnownDataCollectionEndpointResourceKindWindows, - } -} - -// KnownDataCollectionRuleAssociationProvisioningState - The resource provisioning state. -type KnownDataCollectionRuleAssociationProvisioningState string - -const ( - KnownDataCollectionRuleAssociationProvisioningStateCanceled KnownDataCollectionRuleAssociationProvisioningState = "Canceled" - KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" - KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" - KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" - KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" - KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns the possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. -func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { - return []KnownDataCollectionRuleAssociationProvisioningState{ - KnownDataCollectionRuleAssociationProvisioningStateCanceled, - KnownDataCollectionRuleAssociationProvisioningStateCreating, - KnownDataCollectionRuleAssociationProvisioningStateDeleting, - KnownDataCollectionRuleAssociationProvisioningStateFailed, - KnownDataCollectionRuleAssociationProvisioningStateSucceeded, - KnownDataCollectionRuleAssociationProvisioningStateUpdating, - } -} - -// KnownDataCollectionRuleProvisioningState - The resource provisioning state. -type KnownDataCollectionRuleProvisioningState string - -const ( - KnownDataCollectionRuleProvisioningStateCanceled KnownDataCollectionRuleProvisioningState = "Canceled" - KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" - KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" - KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" - KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" - KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleProvisioningStateValues returns the possible values for the KnownDataCollectionRuleProvisioningState const type. -func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { - return []KnownDataCollectionRuleProvisioningState{ - KnownDataCollectionRuleProvisioningStateCanceled, - KnownDataCollectionRuleProvisioningStateCreating, - KnownDataCollectionRuleProvisioningStateDeleting, - KnownDataCollectionRuleProvisioningStateFailed, - KnownDataCollectionRuleProvisioningStateSucceeded, - KnownDataCollectionRuleProvisioningStateUpdating, - } -} - -// KnownDataCollectionRuleResourceKind - The kind of the resource. -type KnownDataCollectionRuleResourceKind string - -const ( - KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" - KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" -) - -// PossibleKnownDataCollectionRuleResourceKindValues returns the possible values for the KnownDataCollectionRuleResourceKind const type. -func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { - return []KnownDataCollectionRuleResourceKind{ - KnownDataCollectionRuleResourceKindLinux, - KnownDataCollectionRuleResourceKindWindows, - } -} - -type KnownDataFlowStreams string - -const ( - KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" - KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" - KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" - KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" - KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownDataFlowStreamsValues returns the possible values for the KnownDataFlowStreams const type. -func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { - return []KnownDataFlowStreams{ - KnownDataFlowStreamsMicrosoftEvent, - KnownDataFlowStreamsMicrosoftInsightsMetrics, - KnownDataFlowStreamsMicrosoftPerf, - KnownDataFlowStreamsMicrosoftSyslog, - KnownDataFlowStreamsMicrosoftWindowsEvent, - } -} - -type KnownExtensionDataSourceStreams string - -const ( - KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" - KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" - KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownExtensionDataSourceStreamsValues returns the possible values for the KnownExtensionDataSourceStreams const type. -func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { - return []KnownExtensionDataSourceStreams{ - KnownExtensionDataSourceStreamsMicrosoftEvent, - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, - KnownExtensionDataSourceStreamsMicrosoftPerf, - KnownExtensionDataSourceStreamsMicrosoftSyslog, - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent, - } -} - -// KnownLocationSpecProvisioningStatus - The resource provisioning state in this location. -type KnownLocationSpecProvisioningStatus string - -const ( - KnownLocationSpecProvisioningStatusCanceled KnownLocationSpecProvisioningStatus = "Canceled" - KnownLocationSpecProvisioningStatusCreating KnownLocationSpecProvisioningStatus = "Creating" - KnownLocationSpecProvisioningStatusDeleting KnownLocationSpecProvisioningStatus = "Deleting" - KnownLocationSpecProvisioningStatusFailed KnownLocationSpecProvisioningStatus = "Failed" - KnownLocationSpecProvisioningStatusSucceeded KnownLocationSpecProvisioningStatus = "Succeeded" - KnownLocationSpecProvisioningStatusUpdating KnownLocationSpecProvisioningStatus = "Updating" -) - -// PossibleKnownLocationSpecProvisioningStatusValues returns the possible values for the KnownLocationSpecProvisioningStatus const type. -func PossibleKnownLocationSpecProvisioningStatusValues() []KnownLocationSpecProvisioningStatus { - return []KnownLocationSpecProvisioningStatus{ - KnownLocationSpecProvisioningStatusCanceled, - KnownLocationSpecProvisioningStatusCreating, - KnownLocationSpecProvisioningStatusDeleting, - KnownLocationSpecProvisioningStatusFailed, - KnownLocationSpecProvisioningStatusSucceeded, - KnownLocationSpecProvisioningStatusUpdating, - } -} - -// KnownLogFileTextSettingsRecordStartTimestampFormat - One of the supported timestamp formats -type KnownLogFileTextSettingsRecordStartTimestampFormat string - -const ( - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMMYyyyHHMmSsZzz KnownLogFileTextSettingsRecordStartTimestampFormat = "dd/MMM/yyyy:HH:mm:ss zzz" - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "ddMMyy HH:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatISO8601 KnownLogFileTextSettingsRecordStartTimestampFormat = "ISO 8601" - KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM KnownLogFileTextSettingsRecordStartTimestampFormat = "M/D/YYYY HH:MM:SS AM/PM" - KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "MMM d hh:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "Mon DD, YYYY HH:MM:SS" - KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "YYYY-MM-DD HH:MM:SS" - KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "yyMMdd HH:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK KnownLogFileTextSettingsRecordStartTimestampFormat = "yyyy-MM-ddTHH:mm:ssK" -) - -// PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues returns the possible values for the KnownLogFileTextSettingsRecordStartTimestampFormat const type. -func PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues() []KnownLogFileTextSettingsRecordStartTimestampFormat { - return []KnownLogFileTextSettingsRecordStartTimestampFormat{ - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMMYyyyHHMmSsZzz, - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatISO8601, - KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM, - KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS, - KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS, - KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK, - } -} - -// KnownLogFilesDataSourceFormat - The data format of the log files -type KnownLogFilesDataSourceFormat string - -const ( - KnownLogFilesDataSourceFormatText KnownLogFilesDataSourceFormat = "text" -) - -// PossibleKnownLogFilesDataSourceFormatValues returns the possible values for the KnownLogFilesDataSourceFormat const type. -func PossibleKnownLogFilesDataSourceFormatValues() []KnownLogFilesDataSourceFormat { - return []KnownLogFilesDataSourceFormat{ - KnownLogFilesDataSourceFormatText, - } -} - -type KnownPerfCounterDataSourceStreams string - -const ( - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" - KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" -) - -// PossibleKnownPerfCounterDataSourceStreamsValues returns the possible values for the KnownPerfCounterDataSourceStreams const type. -func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { - return []KnownPerfCounterDataSourceStreams{ - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, - KnownPerfCounterDataSourceStreamsMicrosoftPerf, - } -} - -type KnownPrometheusForwarderDataSourceStreams string - -const ( - KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics KnownPrometheusForwarderDataSourceStreams = "Microsoft-PrometheusMetrics" -) - -// PossibleKnownPrometheusForwarderDataSourceStreamsValues returns the possible values for the KnownPrometheusForwarderDataSourceStreams const type. -func PossibleKnownPrometheusForwarderDataSourceStreamsValues() []KnownPrometheusForwarderDataSourceStreams { - return []KnownPrometheusForwarderDataSourceStreams{ - KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics, - } -} - -// KnownPublicNetworkAccessOptions - The configuration to set whether network access from public internet to the endpoints -// are allowed. -type KnownPublicNetworkAccessOptions string - -const ( - KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" - KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" - KnownPublicNetworkAccessOptionsSecuredByPerimeter KnownPublicNetworkAccessOptions = "SecuredByPerimeter" -) - -// PossibleKnownPublicNetworkAccessOptionsValues returns the possible values for the KnownPublicNetworkAccessOptions const type. -func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { - return []KnownPublicNetworkAccessOptions{ - KnownPublicNetworkAccessOptionsDisabled, - KnownPublicNetworkAccessOptionsEnabled, - KnownPublicNetworkAccessOptionsSecuredByPerimeter, - } -} - -type KnownSyslogDataSourceFacilityNames string - -const ( - KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" - KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" - KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" - KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" - KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" - KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" - KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" - KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" - KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" - KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" - KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" - KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" - KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" - KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" - KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" - KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" - KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" - KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" - KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" - KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" - KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" -) - -// PossibleKnownSyslogDataSourceFacilityNamesValues returns the possible values for the KnownSyslogDataSourceFacilityNames const type. -func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { - return []KnownSyslogDataSourceFacilityNames{ - KnownSyslogDataSourceFacilityNamesAsterisk, - KnownSyslogDataSourceFacilityNamesAuth, - KnownSyslogDataSourceFacilityNamesAuthpriv, - KnownSyslogDataSourceFacilityNamesCron, - KnownSyslogDataSourceFacilityNamesDaemon, - KnownSyslogDataSourceFacilityNamesKern, - KnownSyslogDataSourceFacilityNamesLocal0, - KnownSyslogDataSourceFacilityNamesLocal1, - KnownSyslogDataSourceFacilityNamesLocal2, - KnownSyslogDataSourceFacilityNamesLocal3, - KnownSyslogDataSourceFacilityNamesLocal4, - KnownSyslogDataSourceFacilityNamesLocal5, - KnownSyslogDataSourceFacilityNamesLocal6, - KnownSyslogDataSourceFacilityNamesLocal7, - KnownSyslogDataSourceFacilityNamesLpr, - KnownSyslogDataSourceFacilityNamesMail, - KnownSyslogDataSourceFacilityNamesMark, - KnownSyslogDataSourceFacilityNamesNews, - KnownSyslogDataSourceFacilityNamesSyslog, - KnownSyslogDataSourceFacilityNamesUser, - KnownSyslogDataSourceFacilityNamesUucp, - } -} - -type KnownSyslogDataSourceLogLevels string - -const ( - KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" - KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" - KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" - KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" - KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" - KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" - KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" - KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" - KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" -) - -// PossibleKnownSyslogDataSourceLogLevelsValues returns the possible values for the KnownSyslogDataSourceLogLevels const type. -func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { - return []KnownSyslogDataSourceLogLevels{ - KnownSyslogDataSourceLogLevelsAlert, - KnownSyslogDataSourceLogLevelsAsterisk, - KnownSyslogDataSourceLogLevelsCritical, - KnownSyslogDataSourceLogLevelsDebug, - KnownSyslogDataSourceLogLevelsEmergency, - KnownSyslogDataSourceLogLevelsError, - KnownSyslogDataSourceLogLevelsInfo, - KnownSyslogDataSourceLogLevelsNotice, - KnownSyslogDataSourceLogLevelsWarning, - } -} - -type KnownSyslogDataSourceStreams string +// IncidentManagementService - The incident management service type +type IncidentManagementService string const ( - KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" + IncidentManagementServiceIcm IncidentManagementService = "Icm" ) -// PossibleKnownSyslogDataSourceStreamsValues returns the possible values for the KnownSyslogDataSourceStreams const type. -func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { - return []KnownSyslogDataSourceStreams{ - KnownSyslogDataSourceStreamsMicrosoftSyslog, +// PossibleIncidentManagementServiceValues returns the possible values for the IncidentManagementService const type. +func PossibleIncidentManagementServiceValues() []IncidentManagementService { + return []IncidentManagementService{ + IncidentManagementServiceIcm, } } -type KnownWindowsEventLogDataSourceStreams string +// Kind - Indicates the type of scheduled query rule. The default is LogAlert. +type Kind string const ( - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" + KindLogAlert Kind = "LogAlert" + KindLogToMetric Kind = "LogToMetric" + KindSimpleLogAlert Kind = "SimpleLogAlert" ) -// PossibleKnownWindowsEventLogDataSourceStreamsValues returns the possible values for the KnownWindowsEventLogDataSourceStreams const type. -func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { - return []KnownWindowsEventLogDataSourceStreams{ - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent, +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindLogAlert, + KindLogToMetric, + KindSimpleLogAlert, } } @@ -771,321 +179,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// MetricAggregationType - the aggregation type of the metric. -type MetricAggregationType string - -const ( - MetricAggregationTypeAverage MetricAggregationType = "Average" - MetricAggregationTypeCount MetricAggregationType = "Count" - MetricAggregationTypeMaximum MetricAggregationType = "Maximum" - MetricAggregationTypeMinimum MetricAggregationType = "Minimum" - MetricAggregationTypeNone MetricAggregationType = "None" - MetricAggregationTypeTotal MetricAggregationType = "Total" -) - -// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. -func PossibleMetricAggregationTypeValues() []MetricAggregationType { - return []MetricAggregationType{ - MetricAggregationTypeAverage, - MetricAggregationTypeCount, - MetricAggregationTypeMaximum, - MetricAggregationTypeMinimum, - MetricAggregationTypeNone, - MetricAggregationTypeTotal, - } -} - -// MetricClass - The class of the metric. -type MetricClass string - -const ( - MetricClassAvailability MetricClass = "Availability" - MetricClassErrors MetricClass = "Errors" - MetricClassLatency MetricClass = "Latency" - MetricClassSaturation MetricClass = "Saturation" - MetricClassTransactions MetricClass = "Transactions" -) - -// PossibleMetricClassValues returns the possible values for the MetricClass const type. -func PossibleMetricClassValues() []MetricClass { - return []MetricClass{ - MetricClassAvailability, - MetricClassErrors, - MetricClassLatency, - MetricClassSaturation, - MetricClassTransactions, - } -} - -// MetricResultType - Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's -// description for details. -type MetricResultType string - -const ( - MetricResultTypeData MetricResultType = "Data" - MetricResultTypeMetadata MetricResultType = "Metadata" -) - -// PossibleMetricResultTypeValues returns the possible values for the MetricResultType const type. -func PossibleMetricResultTypeValues() []MetricResultType { - return []MetricResultType{ - MetricResultTypeData, - MetricResultTypeMetadata, - } -} - -// MetricStatisticType - the metric statistic type. How the metrics from multiple instances are combined. -type MetricStatisticType string - -const ( - MetricStatisticTypeAverage MetricStatisticType = "Average" - MetricStatisticTypeCount MetricStatisticType = "Count" - MetricStatisticTypeMax MetricStatisticType = "Max" - MetricStatisticTypeMin MetricStatisticType = "Min" - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns the possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{ - MetricStatisticTypeAverage, - MetricStatisticTypeCount, - MetricStatisticTypeMax, - MetricStatisticTypeMin, - MetricStatisticTypeSum, - } -} - -// MetricUnit - The unit of the metric. -type MetricUnit string - -const ( - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - MetricUnitBytes MetricUnit = "Bytes" - MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - MetricUnitCores MetricUnit = "Cores" - MetricUnitCount MetricUnit = "Count" - MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - MetricUnitMilliCores MetricUnit = "MilliCores" - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - MetricUnitNanoCores MetricUnit = "NanoCores" - MetricUnitPercent MetricUnit = "Percent" - MetricUnitSeconds MetricUnit = "Seconds" - MetricUnitUnspecified MetricUnit = "Unspecified" -) - -// PossibleMetricUnitValues returns the possible values for the MetricUnit const type. -func PossibleMetricUnitValues() []MetricUnit { - return []MetricUnit{ - MetricUnitBitsPerSecond, - MetricUnitByteSeconds, - MetricUnitBytes, - MetricUnitBytesPerSecond, - MetricUnitCores, - MetricUnitCount, - MetricUnitCountPerSecond, - MetricUnitMilliCores, - MetricUnitMilliSeconds, - MetricUnitNanoCores, - MetricUnitPercent, - MetricUnitSeconds, - MetricUnitUnspecified, - } -} - -// NamespaceClassification - Kind of namespace -type NamespaceClassification string - -const ( - NamespaceClassificationCustom NamespaceClassification = "Custom" - NamespaceClassificationPlatform NamespaceClassification = "Platform" - NamespaceClassificationQos NamespaceClassification = "Qos" -) - -// PossibleNamespaceClassificationValues returns the possible values for the NamespaceClassification const type. -func PossibleNamespaceClassificationValues() []NamespaceClassification { - return []NamespaceClassification{ - NamespaceClassificationCustom, - NamespaceClassificationPlatform, - NamespaceClassificationQos, - } -} - -// Odatatype - specifies the type of the alert criteria. -type Odatatype string - -const ( - OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria Odatatype = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdatatypeValues returns the possible values for the Odatatype const type. -func PossibleOdatatypeValues() []Odatatype { - return []Odatatype{ - OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, - OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, - OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria, - } -} - -// OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, -// is considered onboarded if at least one resource under it is onboarded. -type OnboardingStatus string - -const ( - OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" - OnboardingStatusOnboarded OnboardingStatus = "onboarded" - OnboardingStatusUnknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns the possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{ - OnboardingStatusNotOnboarded, - OnboardingStatusOnboarded, - OnboardingStatusUnknown, - } -} - -// Operator - the criteria operator. -type Operator string - -const ( - OperatorEquals Operator = "Equals" - OperatorGreaterThan Operator = "GreaterThan" - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - OperatorLessThan Operator = "LessThan" - OperatorLessThanOrEqual Operator = "LessThanOrEqual" -) - -// PossibleOperatorValues returns the possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{ - OperatorEquals, - OperatorGreaterThan, - OperatorGreaterThanOrEqual, - OperatorLessThan, - OperatorLessThanOrEqual, - } -} - -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string - -const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - -// PredictiveAutoscalePolicyScaleMode - the predictive autoscale mode -type PredictiveAutoscalePolicyScaleMode string - -const ( - PredictiveAutoscalePolicyScaleModeDisabled PredictiveAutoscalePolicyScaleMode = "Disabled" - PredictiveAutoscalePolicyScaleModeEnabled PredictiveAutoscalePolicyScaleMode = "Enabled" - PredictiveAutoscalePolicyScaleModeForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" -) - -// PossiblePredictiveAutoscalePolicyScaleModeValues returns the possible values for the PredictiveAutoscalePolicyScaleMode const type. -func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode { - return []PredictiveAutoscalePolicyScaleMode{ - PredictiveAutoscalePolicyScaleModeDisabled, - PredictiveAutoscalePolicyScaleModeEnabled, - PredictiveAutoscalePolicyScaleModeForecastOnly, - } -} - -// PrivateEndpointConnectionProvisioningState - The current provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{ - PrivateEndpointConnectionProvisioningStateCreating, - PrivateEndpointConnectionProvisioningStateDeleting, - PrivateEndpointConnectionProvisioningStateFailed, - PrivateEndpointConnectionProvisioningStateSucceeded, - } -} - -// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{ - PrivateEndpointServiceConnectionStatusApproved, - PrivateEndpointServiceConnectionStatusPending, - PrivateEndpointServiceConnectionStatusRejected, - } -} - -// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateCreating, - ProvisioningStateDeleting, - ProvisioningStateFailed, - ProvisioningStateSucceeded, - } -} - -// PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. -type PublicNetworkAccess string - -const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" - PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" -) - -// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{ - PublicNetworkAccessDisabled, - PublicNetworkAccessEnabled, - PublicNetworkAccessSecuredByPerimeter, - } -} - // ReceiverStatus - Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. type ReceiverStatus string @@ -1104,106 +197,6 @@ func PossibleReceiverStatusValues() []ReceiverStatus { } } -// RecurrenceFrequency - 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. -type RecurrenceFrequency string - -const ( - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - RecurrenceFrequencyNone RecurrenceFrequency = "None" - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns the possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{ - RecurrenceFrequencyDay, - RecurrenceFrequencyHour, - RecurrenceFrequencyMinute, - RecurrenceFrequencyMonth, - RecurrenceFrequencyNone, - RecurrenceFrequencySecond, - RecurrenceFrequencyWeek, - RecurrenceFrequencyYear, - } -} - -type ResultType string - -const ( - ResultTypeData ResultType = "Data" - ResultTypeMetadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns the possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ - ResultTypeData, - ResultTypeMetadata, - } -} - -// ScaleDirection - the scale direction. Whether the scaling action increases or decreases the number of instances. -type ScaleDirection string - -const ( - ScaleDirectionDecrease ScaleDirection = "Decrease" - ScaleDirectionIncrease ScaleDirection = "Increase" - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns the possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ - ScaleDirectionDecrease, - ScaleDirectionIncrease, - ScaleDirectionNone, - } -} - -// ScaleRuleMetricDimensionOperationType - 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 -type ScaleRuleMetricDimensionOperationType string - -const ( - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns the possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ - ScaleRuleMetricDimensionOperationTypeEquals, - ScaleRuleMetricDimensionOperationTypeNotEquals, - } -} - -// ScaleType - the type of action that should occur when the scale rule fires. -type ScaleType string - -const ( - ScaleTypeChangeCount ScaleType = "ChangeCount" - ScaleTypeExactCount ScaleType = "ExactCount" - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" - ScaleTypeServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" -) - -// PossibleScaleTypeValues returns the possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ - ScaleTypeChangeCount, - ScaleTypeExactCount, - ScaleTypePercentChangeCount, - ScaleTypeServiceAllowedNextValue, - } -} - // TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. type TimeAggregation string @@ -1225,88 +218,3 @@ func PossibleTimeAggregationValues() []TimeAggregation { TimeAggregationTotal, } } - -// TimeAggregationOperator - Aggregation operators allowed in a rule. -type TimeAggregationOperator string - -const ( - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns the possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{ - TimeAggregationOperatorAverage, - TimeAggregationOperatorLast, - TimeAggregationOperatorMaximum, - TimeAggregationOperatorMinimum, - TimeAggregationOperatorTotal, - } -} - -// TimeAggregationType - time aggregation type. How the data that is collected should be combined over time. The default value -// is Average. -type TimeAggregationType string - -const ( - TimeAggregationTypeAverage TimeAggregationType = "Average" - TimeAggregationTypeCount TimeAggregationType = "Count" - TimeAggregationTypeLast TimeAggregationType = "Last" - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns the possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{ - TimeAggregationTypeAverage, - TimeAggregationTypeCount, - TimeAggregationTypeLast, - TimeAggregationTypeMaximum, - TimeAggregationTypeMinimum, - TimeAggregationTypeTotal, - } -} - -// Unit - The unit of the metric. -type Unit string - -const ( - UnitBitsPerSecond Unit = "BitsPerSecond" - UnitByteSeconds Unit = "ByteSeconds" - UnitBytes Unit = "Bytes" - UnitBytesPerSecond Unit = "BytesPerSecond" - UnitCores Unit = "Cores" - UnitCount Unit = "Count" - UnitCountPerSecond Unit = "CountPerSecond" - UnitMilliCores Unit = "MilliCores" - UnitMilliSeconds Unit = "MilliSeconds" - UnitNanoCores Unit = "NanoCores" - UnitPercent Unit = "Percent" - UnitSeconds Unit = "Seconds" - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns the possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{ - UnitBitsPerSecond, - UnitByteSeconds, - UnitBytes, - UnitBytesPerSecond, - UnitCores, - UnitCount, - UnitCountPerSecond, - UnitMilliCores, - UnitMilliSeconds, - UnitNanoCores, - UnitPercent, - UnitSeconds, - UnitUnspecified, - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go deleted file mode 100644 index 7ec4fe0471b7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go +++ /dev/null @@ -1,421 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionEndpointsClient contains the methods for the DataCollectionEndpoints group. -// Don't use this type directly, use NewDataCollectionEndpointsClient() instead. -type DataCollectionEndpointsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionEndpointsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionEndpointsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create -// method. -func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (DataCollectionEndpointsClientCreateResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Response) (DataCollectionEndpointsClientCreateResponse, error) { - result := DataCollectionEndpointsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete -// method. -func (client *DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientDeleteOptions) (DataCollectionEndpointsClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientDeleteResponse{}, err - } - return DataCollectionEndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get -// method. -func (client *DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientGetOptions) (DataCollectionEndpointsClientGetResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Response) (DataCollectionEndpointsClientGetResponse, error) { - result := DataCollectionEndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all data collection endpoints in the specified resource group. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager -// method. -func (client *DataCollectionEndpointsClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionEndpointsClientListByResourceGroupOptions) *runtime.Pager[DataCollectionEndpointsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListByResourceGroupResponse]{ - More: func(page DataCollectionEndpointsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListByResourceGroupResponse) (DataCollectionEndpointsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return DataCollectionEndpointsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataCollectionEndpointsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListByResourceGroupResponse, error) { - result := DataCollectionEndpointsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all data collection endpoints in the specified subscription -// -// Generated from API version 2022-06-01 -// - options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager -// method. -func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options *DataCollectionEndpointsClientListBySubscriptionOptions) *runtime.Pager[DataCollectionEndpointsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListBySubscriptionResponse]{ - More: func(page DataCollectionEndpointsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListBySubscriptionResponse) (DataCollectionEndpointsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return DataCollectionEndpointsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionEndpointsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListBySubscriptionResponse, error) { - result := DataCollectionEndpointsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update -// method. -func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (DataCollectionEndpointsClientUpdateResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *DataCollectionEndpointsClient) updateHandleResponse(resp *http.Response) (DataCollectionEndpointsClientUpdateResponse, error) { - result := DataCollectionEndpointsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go deleted file mode 100644 index 18d81e003a18..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ /dev/null @@ -1,378 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListByResourceGroup.json -func ExampleDataCollectionEndpointsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListBySubscription.json -func ExampleDataCollectionEndpointsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsGet.json -func ExampleDataCollectionEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Get(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsCreate.json -func ExampleDataCollectionEndpointsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientCreateOptions{Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsUpdate.json -func ExampleDataCollectionEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Update(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsDelete.json -func ExampleDataCollectionEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionEndpointsClient().Delete(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go deleted file mode 100644 index 820b5876aabb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go +++ /dev/null @@ -1,397 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionRuleAssociationsClient contains the methods for the DataCollectionRuleAssociations group. -// Don't use this type directly, use NewDataCollectionRuleAssociationsClient() instead. -type DataCollectionRuleAssociationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRuleAssociationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionRuleAssociationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates an association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create -// method. -func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (DataCollectionRuleAssociationsClientCreateResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientCreateResponse, error) { - result := DataCollectionRuleAssociationsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes an association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete -// method. -func (client *DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (DataCollectionRuleAssociationsClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - return DataCollectionRuleAssociationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get -// method. -func (client *DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (DataCollectionRuleAssociationsClientGetResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientGetResponse, error) { - result := DataCollectionRuleAssociationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByDataCollectionEndpointPager - Lists associations for the specified data collection endpoint. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for -// the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager method. -func (client *DataCollectionRuleAssociationsClient) NewListByDataCollectionEndpointPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse) (DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByDataCollectionEndpointCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{}, err - } - return client.listByDataCollectionEndpointHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByDataCollectionEndpointCreateRequest creates the ListByDataCollectionEndpoint request. -func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpointCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByDataCollectionEndpointHandleResponse handles the ListByDataCollectionEndpoint response. -func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpointHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, error) { - result := DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{}, err - } - return result, nil -} - -// NewListByResourcePager - Lists associations for the specified resource. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - options - DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager -// method. -func (client *DataCollectionRuleAssociationsClient) NewListByResourcePager(resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByResourceResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByResourceResponse) (DataCollectionRuleAssociationsClientListByResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByResourcePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceCreateRequest(ctx, resourceURI, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByResourceResponse{}, err - } - return client.listByResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceCreateRequest creates the ListByResource request. -func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest(ctx context.Context, resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceHandleResponse handles the ListByResource response. -func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByResourceResponse, error) { - result := DataCollectionRuleAssociationsClientListByResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByResourceResponse{}, err - } - return result, nil -} - -// NewListByRulePager - Lists associations for the specified data collection rule. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager -// method. -func (client *DataCollectionRuleAssociationsClient) NewListByRulePager(resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRuleAssociationsClientListByRuleOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByRuleResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByRuleResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByRuleResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByRuleResponse) (DataCollectionRuleAssociationsClientListByRuleResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByRulePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByRuleCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByRuleResponse{}, err - } - return client.listByRuleHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByRuleCreateRequest creates the ListByRule request. -func (client *DataCollectionRuleAssociationsClient) listByRuleCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRuleAssociationsClientListByRuleOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByRuleHandleResponse handles the ListByRule response. -func (client *DataCollectionRuleAssociationsClient) listByRuleHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByRuleResponse, error) { - result := DataCollectionRuleAssociationsClientListByRuleResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByRuleResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go deleted file mode 100644 index 75d9d8aacedc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByResource.json -func ExampleDataCollectionRuleAssociationsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByResourcePager("subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("herRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/herRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myEndpointAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("562d96b1-29e9-4250-b2fd-8bebfdf77a9d"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myEndpointAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByRule.json -func ExampleDataCollectionRuleAssociationsClient_NewListByRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByRulePager("myResourceGroup", "myCollectionRule", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json -func ExampleDataCollectionRuleAssociationsClient_NewListByDataCollectionEndpointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByDataCollectionEndpointPager("myResourceGroup", "myDataCollectionEndpointName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsGet.json -func ExampleDataCollectionRuleAssociationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Get(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsCreate.json -func ExampleDataCollectionRuleAssociationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsDelete.json -func ExampleDataCollectionRuleAssociationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRuleAssociationsClient().Delete(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go deleted file mode 100644 index bac67caf57ba..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go +++ /dev/null @@ -1,420 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionRulesClient contains the methods for the DataCollectionRules group. -// Don't use this type directly, use NewDataCollectionRulesClient() instead. -type DataCollectionRulesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionRulesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create -// method. -func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (DataCollectionRulesClientCreateResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Response) (DataCollectionRulesClientCreateResponse, error) { - result := DataCollectionRulesClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete -// method. -func (client *DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientDeleteOptions) (DataCollectionRulesClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientDeleteResponse{}, err - } - return DataCollectionRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. -func (client *DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientGetOptions) (DataCollectionRulesClientGetResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) (DataCollectionRulesClientGetResponse, error) { - result := DataCollectionRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all data collection rules in the specified resource group. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager -// method. -func (client *DataCollectionRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionRulesClientListByResourceGroupOptions) *runtime.Pager[DataCollectionRulesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListByResourceGroupResponse]{ - More: func(page DataCollectionRulesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRulesClientListByResourceGroupResponse) (DataCollectionRulesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRulesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return DataCollectionRulesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataCollectionRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionRulesClientListByResourceGroupResponse, error) { - result := DataCollectionRulesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all data collection rules in the specified subscription. -// -// Generated from API version 2022-06-01 -// - options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager -// method. -func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *DataCollectionRulesClientListBySubscriptionOptions) *runtime.Pager[DataCollectionRulesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListBySubscriptionResponse]{ - More: func(page DataCollectionRulesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRulesClientListBySubscriptionResponse) (DataCollectionRulesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRulesClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return DataCollectionRulesClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionRulesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionRulesClientListBySubscriptionResponse, error) { - result := DataCollectionRulesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update -// method. -func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (DataCollectionRulesClientUpdateResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *DataCollectionRulesClient) updateHandleResponse(resp *http.Response) (DataCollectionRulesClientUpdateResponse, error) { - result := DataCollectionRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go deleted file mode 100644 index 34f152aaad68..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ /dev/null @@ -1,864 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListByResourceGroup.json -func ExampleDataCollectionRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListBySubscription.json -func ExampleDataCollectionRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesGet.json -func ExampleDataCollectionRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Get(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesCreate.json -func ExampleDataCollectionRulesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientCreateOptions{Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ - { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - }}, - DataSources: &armmonitor.DataCollectionRuleDataSources{ - PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - { - Name: to.Ptr("cloudTeamCoreCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Processor(_Total)\\% Processor Time"), - to.Ptr("\\Memory\\Committed Bytes"), - to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - SamplingFrequencyInSeconds: to.Ptr[int32](15), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }, - { - Name: to.Ptr("appTeamExtraCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, - SamplingFrequencyInSeconds: to.Ptr[int32](30), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, - Syslog: []*armmonitor.SyslogDataSource{ - { - Name: to.Ptr("cronSyslog"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }, - { - Name: to.Ptr("syslogBase"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, - WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - { - Name: to.Ptr("cloudSecurityTeamEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("Security!")}, - }, - { - Name: to.Ptr("appTeam1AppEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - }}, - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesUpdate.json -func ExampleDataCollectionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Update(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesDelete.json -func ExampleDataCollectionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRulesClient().Delete(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go deleted file mode 100644 index 38f727b02b43..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go +++ /dev/null @@ -1,262 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DiagnosticSettingsClient contains the methods for the DiagnosticSettings group. -// Don't use this type directly, use NewDiagnosticSettingsClient() instead. -type DiagnosticSettingsClient struct { - internal *arm.Client -} - -// NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DiagnosticSettingsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - parameters - Parameters supplied to the operation. -// - options - DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate -// method. -func (client *DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsClientCreateOrUpdateOptions) (DiagnosticSettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, name, parameters, options) - if err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DiagnosticSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *DiagnosticSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (DiagnosticSettingsClientCreateOrUpdateResponse, error) { - result := DiagnosticSettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes existing diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete -// method. -func (client *DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientDeleteOptions) (DiagnosticSettingsClientDeleteResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientDeleteResponse{}, err - } - return DiagnosticSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DiagnosticSettingsClient) deleteCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the active diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. -func (client *DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientGetOptions) (DiagnosticSettingsClientGetResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DiagnosticSettingsClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DiagnosticSettingsClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsClientGetResponse, error) { - result := DiagnosticSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets the active diagnostic settings list for the specified resource. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - options - DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager -// method. -func (client *DiagnosticSettingsClient) NewListPager(resourceURI string, options *DiagnosticSettingsClientListOptions) *runtime.Pager[DiagnosticSettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsClientListResponse]{ - More: func(page DiagnosticSettingsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DiagnosticSettingsClientListResponse) (DiagnosticSettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiagnosticSettingsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DiagnosticSettingsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DiagnosticSettingsClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DiagnosticSettingsClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsClientListResponse, error) { - result := DiagnosticSettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResourceCollection); err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go deleted file mode 100644 index 6bfb57627706..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,404 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - CategoryGroup: to.Ptr("allLogs"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - Category: to.Ptr("WorkflowRuntime"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticSettingsClient().Delete(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("microsoft.logic/workflows"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go deleted file mode 100644 index e9a6fee568c2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DiagnosticSettingsCategoryClient contains the methods for the DiagnosticSettingsCategory group. -// Don't use this type directly, use NewDiagnosticSettingsCategoryClient() instead. -type DiagnosticSettingsCategoryClient struct { - internal *arm.Client -} - -// NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDiagnosticSettingsCategoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsCategoryClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DiagnosticSettingsCategoryClient{ - internal: cl, - } - return client, nil -} - -// Get - Gets the diagnostic settings category for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get -// method. -func (client *DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryClientGetOptions) (DiagnosticSettingsCategoryClientGetResponse, error) { - var err error - const operationName = "DiagnosticSettingsCategoryClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DiagnosticSettingsCategoryClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DiagnosticSettingsCategoryClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryClientGetResponse, error) { - result := DiagnosticSettingsCategoryClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResource); err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists the diagnostic settings categories for the specified resource. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - options - DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager -// method. -func (client *DiagnosticSettingsCategoryClient) NewListPager(resourceURI string, options *DiagnosticSettingsCategoryClientListOptions) *runtime.Pager[DiagnosticSettingsCategoryClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsCategoryClientListResponse]{ - More: func(page DiagnosticSettingsCategoryClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DiagnosticSettingsCategoryClientListResponse) (DiagnosticSettingsCategoryClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiagnosticSettingsCategoryClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DiagnosticSettingsCategoryClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DiagnosticSettingsCategoryClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsCategoryClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DiagnosticSettingsCategoryClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryClientListResponse, error) { - result := DiagnosticSettingsCategoryClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResourceCollection); err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go deleted file mode 100644 index 4b667e1fa043..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsCategoryClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsCategoryClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "WorkflowRuntime", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsCategoryResource = armmonitor.DiagnosticSettingsCategoryResource{ - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json -func ExampleDiagnosticSettingsCategoryClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsCategoryClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsCategoryResourceCollection = armmonitor.DiagnosticSettingsCategoryResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsCategoryResource{ - // { - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // }, - // { - // Name: to.Ptr("WorkflowMetric"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowMetric"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryType: to.Ptr(armmonitor.CategoryTypeMetrics), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go deleted file mode 100644 index d89ab8bca7fb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// EventCategoriesClient contains the methods for the EventCategories group. -// Don't use this type directly, use NewEventCategoriesClient() instead. -type EventCategoriesClient struct { - internal *arm.Client -} - -// NewEventCategoriesClient creates a new instance of EventCategoriesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EventCategoriesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &EventCategoriesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Get the list of available event categories supported in the Activity Logs Service. The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -// -// Generated from API version 2015-04-01 -// - options - EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager -// method. -func (client *EventCategoriesClient) NewListPager(options *EventCategoriesClientListOptions) *runtime.Pager[EventCategoriesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[EventCategoriesClientListResponse]{ - More: func(page EventCategoriesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *EventCategoriesClientListResponse) (EventCategoriesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventCategoriesClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return EventCategoriesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventCategoriesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventCategoriesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *EventCategoriesClient) listCreateRequest(ctx context.Context, options *EventCategoriesClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/eventcategories" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *EventCategoriesClient) listHandleResponse(resp *http.Response) (EventCategoriesClientListResponse, error) { - result := EventCategoriesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventCategoryCollection); err != nil { - return EventCategoriesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go deleted file mode 100644 index 765f747c362c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json -func ExampleEventCategoriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventCategoriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventCategoryCollection = armmonitor.EventCategoryCollection{ - // Value: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("category1"), - // Value: to.Ptr("category1"), - // }, - // { - // LocalizedValue: to.Ptr("category2"), - // Value: to.Ptr("category2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go index b9ce2adcbcc5..1fcce6a76839 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -89,37 +86,56 @@ func (a *ActionGroupsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel": - resp, err = a.dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req) - case "ActionGroupsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "ActionGroupsClient.Delete": - resp, err = a.dispatchDelete(req) - case "ActionGroupsClient.EnableReceiver": - resp, err = a.dispatchEnableReceiver(req) - case "ActionGroupsClient.Get": - resp, err = a.dispatchGet(req) - case "ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel": - resp, err = a.dispatchGetTestNotificationsAtActionGroupResourceLevel(req) - case "ActionGroupsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "ActionGroupsClient.NewListBySubscriptionIDPager": - resp, err = a.dispatchNewListBySubscriptionIDPager(req) - case "ActionGroupsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return a.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (a *ActionGroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if actionGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = actionGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel": + res.resp, res.err = a.dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req) + case "ActionGroupsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ActionGroupsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ActionGroupsClient.EnableReceiver": + res.resp, res.err = a.dispatchEnableReceiver(req) + case "ActionGroupsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel": + res.resp, res.err = a.dispatchGetTestNotificationsAtActionGroupResourceLevel(req) + case "ActionGroupsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "ActionGroupsClient.NewListBySubscriptionIDPager": + res.resp, res.err = a.dispatchNewListBySubscriptionIDPager(req) + case "ActionGroupsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ActionGroupsServerTransport) dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req *http.Request) (*http.Response, error) { @@ -447,3 +463,9 @@ func (a *ActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to ActionGroupsServerTransport +var actionGroupsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go deleted file mode 100644 index afa6587b1626..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// ActivityLogAlertsServer is a fake server for instances of the armmonitor.ActivityLogAlertsClient type. -type ActivityLogAlertsServer struct { - // CreateOrUpdate is the fake for method ActivityLogAlertsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule armmonitor.ActivityLogAlertResource, options *armmonitor.ActivityLogAlertsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ActivityLogAlertsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *armmonitor.ActivityLogAlertsClientDeleteOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ActivityLogAlertsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *armmonitor.ActivityLogAlertsClientGetOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method ActivityLogAlertsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.ActivityLogAlertsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]) - - // NewListBySubscriptionIDPager is the fake for method ActivityLogAlertsClient.NewListBySubscriptionIDPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionIDPager func(options *armmonitor.ActivityLogAlertsClientListBySubscriptionIDOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]) - - // Update is the fake for method ActivityLogAlertsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch armmonitor.AlertRulePatchObject, options *armmonitor.ActivityLogAlertsClientUpdateOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewActivityLogAlertsServerTransport creates a new instance of ActivityLogAlertsServerTransport with the provided implementation. -// The returned ActivityLogAlertsServerTransport instance is connected to an instance of armmonitor.ActivityLogAlertsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewActivityLogAlertsServerTransport(srv *ActivityLogAlertsServer) *ActivityLogAlertsServerTransport { - return &ActivityLogAlertsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]](), - newListBySubscriptionIDPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]](), - } -} - -// ActivityLogAlertsServerTransport connects instances of armmonitor.ActivityLogAlertsClient to instances of ActivityLogAlertsServer. -// Don't use this type directly, use NewActivityLogAlertsServerTransport instead. -type ActivityLogAlertsServerTransport struct { - srv *ActivityLogAlertsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]] - newListBySubscriptionIDPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]] -} - -// Do implements the policy.Transporter interface for ActivityLogAlertsServerTransport. -func (a *ActivityLogAlertsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ActivityLogAlertsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "ActivityLogAlertsClient.Delete": - resp, err = a.dispatchDelete(req) - case "ActivityLogAlertsClient.Get": - resp, err = a.dispatchGet(req) - case "ActivityLogAlertsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "ActivityLogAlertsClient.NewListBySubscriptionIDPager": - resp, err = a.dispatchNewListBySubscriptionIDPager(req) - case "ActivityLogAlertsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ActivityLogAlertResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.ActivityLogAlertsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchNewListBySubscriptionIDPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionIDPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionIDPager not implemented")} - } - newListBySubscriptionIDPager := a.newListBySubscriptionIDPager.get(req) - if newListBySubscriptionIDPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionIDPager(nil) - newListBySubscriptionIDPager = &resp - a.newListBySubscriptionIDPager.add(req, newListBySubscriptionIDPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionIDPager, req, func(page *armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionIDPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionIDPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionIDPager) { - a.newListBySubscriptionIDPager.remove(req) - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRulePatchObject](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go deleted file mode 100644 index c4ee8d74974b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// ActivityLogsServer is a fake server for instances of the armmonitor.ActivityLogsClient type. -type ActivityLogsServer struct { - // NewListPager is the fake for method ActivityLogsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(filter string, options *armmonitor.ActivityLogsClientListOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]) -} - -// NewActivityLogsServerTransport creates a new instance of ActivityLogsServerTransport with the provided implementation. -// The returned ActivityLogsServerTransport instance is connected to an instance of armmonitor.ActivityLogsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewActivityLogsServerTransport(srv *ActivityLogsServer) *ActivityLogsServerTransport { - return &ActivityLogsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]](), - } -} - -// ActivityLogsServerTransport connects instances of armmonitor.ActivityLogsClient to instances of ActivityLogsServer. -// Don't use this type directly, use NewActivityLogsServerTransport instead. -type ActivityLogsServerTransport struct { - srv *ActivityLogsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ActivityLogsServerTransport. -func (a *ActivityLogsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ActivityLogsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := a.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/eventtypes/management/values` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - filterParam, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - selectUnescaped, err := url.QueryUnescape(qp.Get("$select")) - if err != nil { - return nil, err - } - selectParam := getOptional(selectUnescaped) - var options *armmonitor.ActivityLogsClientListOptions - if selectParam != nil { - options = &armmonitor.ActivityLogsClientListOptions{ - Select: selectParam, - } - } - resp := a.srv.NewListPager(filterParam, options) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.ActivityLogsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - a.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go deleted file mode 100644 index 2cc2b603081b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AlertRuleIncidentsServer is a fake server for instances of the armmonitor.AlertRuleIncidentsClient type. -type AlertRuleIncidentsServer struct { - // Get is the fake for method AlertRuleIncidentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *armmonitor.AlertRuleIncidentsClientGetOptions) (resp azfake.Responder[armmonitor.AlertRuleIncidentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByAlertRulePager is the fake for method AlertRuleIncidentsClient.NewListByAlertRulePager - // HTTP status codes to indicate success: http.StatusOK - NewListByAlertRulePager func(resourceGroupName string, ruleName string, options *armmonitor.AlertRuleIncidentsClientListByAlertRuleOptions) (resp azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]) -} - -// NewAlertRuleIncidentsServerTransport creates a new instance of AlertRuleIncidentsServerTransport with the provided implementation. -// The returned AlertRuleIncidentsServerTransport instance is connected to an instance of armmonitor.AlertRuleIncidentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertRuleIncidentsServerTransport(srv *AlertRuleIncidentsServer) *AlertRuleIncidentsServerTransport { - return &AlertRuleIncidentsServerTransport{ - srv: srv, - newListByAlertRulePager: newTracker[azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]](), - } -} - -// AlertRuleIncidentsServerTransport connects instances of armmonitor.AlertRuleIncidentsClient to instances of AlertRuleIncidentsServer. -// Don't use this type directly, use NewAlertRuleIncidentsServerTransport instead. -type AlertRuleIncidentsServerTransport struct { - srv *AlertRuleIncidentsServer - newListByAlertRulePager *tracker[azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]] -} - -// Do implements the policy.Transporter interface for AlertRuleIncidentsServerTransport. -func (a *AlertRuleIncidentsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AlertRuleIncidentsClient.Get": - resp, err = a.dispatchGet(req) - case "AlertRuleIncidentsClient.NewListByAlertRulePager": - resp, err = a.dispatchNewListByAlertRulePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertRuleIncidentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/incidents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - incidentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("incidentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, incidentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Incident, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRuleIncidentsServerTransport) dispatchNewListByAlertRulePager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAlertRulePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAlertRulePager not implemented")} - } - newListByAlertRulePager := a.newListByAlertRulePager.get(req) - if newListByAlertRulePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/incidents` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByAlertRulePager(resourceGroupNameParam, ruleNameParam, nil) - newListByAlertRulePager = &resp - a.newListByAlertRulePager.add(req, newListByAlertRulePager) - } - resp, err := server.PagerResponderNext(newListByAlertRulePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByAlertRulePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByAlertRulePager) { - a.newListByAlertRulePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go deleted file mode 100644 index 4e2c26ad9087..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go +++ /dev/null @@ -1,307 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AlertRulesServer is a fake server for instances of the armmonitor.AlertRulesClient type. -type AlertRulesServer struct { - // CreateOrUpdate is the fake for method AlertRulesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.AlertRuleResource, options *armmonitor.AlertRulesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.AlertRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AlertRulesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.AlertRulesClientDeleteOptions) (resp azfake.Responder[armmonitor.AlertRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AlertRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.AlertRulesClientGetOptions) (resp azfake.Responder[armmonitor.AlertRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AlertRulesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AlertRulesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AlertRulesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AlertRulesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]) - - // Update is the fake for method AlertRulesClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Update func(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource armmonitor.AlertRuleResourcePatch, options *armmonitor.AlertRulesClientUpdateOptions) (resp azfake.Responder[armmonitor.AlertRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAlertRulesServerTransport creates a new instance of AlertRulesServerTransport with the provided implementation. -// The returned AlertRulesServerTransport instance is connected to an instance of armmonitor.AlertRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertRulesServerTransport(srv *AlertRulesServer) *AlertRulesServerTransport { - return &AlertRulesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]](), - } -} - -// AlertRulesServerTransport connects instances of armmonitor.AlertRulesClient to instances of AlertRulesServer. -// Don't use this type directly, use NewAlertRulesServerTransport instead. -type AlertRulesServerTransport struct { - srv *AlertRulesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AlertRulesServerTransport. -func (a *AlertRulesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AlertRulesClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AlertRulesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AlertRulesClient.Get": - resp, err = a.dispatchGet(req) - case "AlertRulesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AlertRulesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AlertRulesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRuleResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRuleResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go deleted file mode 100644 index d28f9819f873..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AutoscaleSettingsServer is a fake server for instances of the armmonitor.AutoscaleSettingsClient type. -type AutoscaleSettingsServer struct { - // CreateOrUpdate is the fake for method AutoscaleSettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters armmonitor.AutoscaleSettingResource, options *armmonitor.AutoscaleSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AutoscaleSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *armmonitor.AutoscaleSettingsClientDeleteOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AutoscaleSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *armmonitor.AutoscaleSettingsClientGetOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AutoscaleSettingsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AutoscaleSettingsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AutoscaleSettingsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AutoscaleSettingsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]) - - // Update is the fake for method AutoscaleSettingsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource armmonitor.AutoscaleSettingResourcePatch, options *armmonitor.AutoscaleSettingsClientUpdateOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAutoscaleSettingsServerTransport creates a new instance of AutoscaleSettingsServerTransport with the provided implementation. -// The returned AutoscaleSettingsServerTransport instance is connected to an instance of armmonitor.AutoscaleSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAutoscaleSettingsServerTransport(srv *AutoscaleSettingsServer) *AutoscaleSettingsServerTransport { - return &AutoscaleSettingsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]](), - } -} - -// AutoscaleSettingsServerTransport connects instances of armmonitor.AutoscaleSettingsClient to instances of AutoscaleSettingsServer. -// Don't use this type directly, use NewAutoscaleSettingsServerTransport instead. -type AutoscaleSettingsServerTransport struct { - srv *AutoscaleSettingsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AutoscaleSettingsServerTransport. -func (a *AutoscaleSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AutoscaleSettingsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AutoscaleSettingsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AutoscaleSettingsClient.Get": - resp, err = a.dispatchGet(req) - case "AutoscaleSettingsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AutoscaleSettingsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AutoscaleSettingsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.AutoscaleSettingsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.AutoscaleSettingsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go deleted file mode 100644 index 5cd33be01e72..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go +++ /dev/null @@ -1,321 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AzureMonitorWorkspacesServer is a fake server for instances of the armmonitor.AzureMonitorWorkspacesClient type. -type AzureMonitorWorkspacesServer struct { - // Create is the fake for method AzureMonitorWorkspacesClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties armmonitor.AzureMonitorWorkspaceResource, options *armmonitor.AzureMonitorWorkspacesClientCreateOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AzureMonitorWorkspacesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientDeleteOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AzureMonitorWorkspacesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientGetOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AzureMonitorWorkspacesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AzureMonitorWorkspacesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AzureMonitorWorkspacesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AzureMonitorWorkspacesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]) - - // Update is the fake for method AzureMonitorWorkspacesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientUpdateOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAzureMonitorWorkspacesServerTransport creates a new instance of AzureMonitorWorkspacesServerTransport with the provided implementation. -// The returned AzureMonitorWorkspacesServerTransport instance is connected to an instance of armmonitor.AzureMonitorWorkspacesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) *AzureMonitorWorkspacesServerTransport { - return &AzureMonitorWorkspacesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]](), - } -} - -// AzureMonitorWorkspacesServerTransport connects instances of armmonitor.AzureMonitorWorkspacesClient to instances of AzureMonitorWorkspacesServer. -// Don't use this type directly, use NewAzureMonitorWorkspacesServerTransport instead. -type AzureMonitorWorkspacesServerTransport struct { - srv *AzureMonitorWorkspacesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AzureMonitorWorkspacesServerTransport. -func (a *AzureMonitorWorkspacesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AzureMonitorWorkspacesClient.Create": - resp, err = a.dispatchCreate(req) - case "AzureMonitorWorkspacesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AzureMonitorWorkspacesClient.Get": - resp, err = a.dispatchGet(req) - case "AzureMonitorWorkspacesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureMonitorWorkspacesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureMonitorWorkspacesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorWorkspaceResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorWorkspaceResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - var options *armmonitor.AzureMonitorWorkspacesClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.AzureMonitorWorkspacesClientUpdateOptions{ - AzureMonitorWorkspaceProperties: &body, - } - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go deleted file mode 100644 index 2207055d2a6d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go +++ /dev/null @@ -1,158 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// BaselinesServer is a fake server for instances of the armmonitor.BaselinesClient type. -type BaselinesServer struct { - // NewListPager is the fake for method BaselinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.BaselinesClientListOptions) (resp azfake.PagerResponder[armmonitor.BaselinesClientListResponse]) -} - -// NewBaselinesServerTransport creates a new instance of BaselinesServerTransport with the provided implementation. -// The returned BaselinesServerTransport instance is connected to an instance of armmonitor.BaselinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBaselinesServerTransport(srv *BaselinesServer) *BaselinesServerTransport { - return &BaselinesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.BaselinesClientListResponse]](), - } -} - -// BaselinesServerTransport connects instances of armmonitor.BaselinesClient to instances of BaselinesServer. -// Don't use this type directly, use NewBaselinesServerTransport instead. -type BaselinesServerTransport struct { - srv *BaselinesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.BaselinesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BaselinesServerTransport. -func (b *BaselinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BaselinesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricBaselines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - sensitivitiesUnescaped, err := url.QueryUnescape(qp.Get("sensitivities")) - if err != nil { - return nil, err - } - sensitivitiesParam := getOptional(sensitivitiesUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.ResultType(resultTypeUnescaped)) - var options *armmonitor.BaselinesClientListOptions - if metricnamesParam != nil || metricnamespaceParam != nil || timespanParam != nil || intervalParam != nil || aggregationParam != nil || sensitivitiesParam != nil || filterParam != nil || resultTypeParam != nil { - options = &armmonitor.BaselinesClientListOptions{ - Metricnames: metricnamesParam, - Metricnamespace: metricnamespaceParam, - Timespan: timespanParam, - Interval: intervalParam, - Aggregation: aggregationParam, - Sensitivities: sensitivitiesParam, - Filter: filterParam, - ResultType: resultTypeParam, - } - } - resp := b.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go deleted file mode 100644 index c9c1040975d0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go +++ /dev/null @@ -1,327 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionEndpointsServer is a fake server for instances of the armmonitor.DataCollectionEndpointsClient type. -type DataCollectionEndpointsServer struct { - // Create is the fake for method DataCollectionEndpointsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionEndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionEndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method DataCollectionEndpointsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.DataCollectionEndpointsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method DataCollectionEndpointsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.DataCollectionEndpointsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]) - - // Update is the fake for method DataCollectionEndpointsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewDataCollectionEndpointsServerTransport creates a new instance of DataCollectionEndpointsServerTransport with the provided implementation. -// The returned DataCollectionEndpointsServerTransport instance is connected to an instance of armmonitor.DataCollectionEndpointsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionEndpointsServerTransport(srv *DataCollectionEndpointsServer) *DataCollectionEndpointsServerTransport { - return &DataCollectionEndpointsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]](), - } -} - -// DataCollectionEndpointsServerTransport connects instances of armmonitor.DataCollectionEndpointsClient to instances of DataCollectionEndpointsServer. -// Don't use this type directly, use NewDataCollectionEndpointsServerTransport instead. -type DataCollectionEndpointsServerTransport struct { - srv *DataCollectionEndpointsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionEndpointsServerTransport. -func (d *DataCollectionEndpointsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionEndpointsClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionEndpointsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionEndpointsClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionEndpointsClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DataCollectionEndpointsClient.NewListBySubscriptionPager": - resp, err = d.dispatchNewListBySubscriptionPager(req) - case "DataCollectionEndpointsClient.Update": - resp, err = d.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionEndpointResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionEndpointsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionEndpointsClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := d.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - d.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - d.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - d.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if d.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionEndpointsClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionEndpointsClientUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go deleted file mode 100644 index 989f81389657..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go +++ /dev/null @@ -1,335 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionRuleAssociationsServer is a fake server for instances of the armmonitor.DataCollectionRuleAssociationsClient type. -type DataCollectionRuleAssociationsServer struct { - // Create is the fake for method DataCollectionRuleAssociationsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionRuleAssociationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionRuleAssociationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByDataCollectionEndpointPager is the fake for method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager - // HTTP status codes to indicate success: http.StatusOK - NewListByDataCollectionEndpointPager func(resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]) - - // NewListByResourcePager is the fake for method DataCollectionRuleAssociationsClient.NewListByResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourcePager func(resourceURI string, options *armmonitor.DataCollectionRuleAssociationsClientListByResourceOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]) - - // NewListByRulePager is the fake for method DataCollectionRuleAssociationsClient.NewListByRulePager - // HTTP status codes to indicate success: http.StatusOK - NewListByRulePager func(resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRuleAssociationsClientListByRuleOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]) -} - -// NewDataCollectionRuleAssociationsServerTransport creates a new instance of DataCollectionRuleAssociationsServerTransport with the provided implementation. -// The returned DataCollectionRuleAssociationsServerTransport instance is connected to an instance of armmonitor.DataCollectionRuleAssociationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionRuleAssociationsServerTransport(srv *DataCollectionRuleAssociationsServer) *DataCollectionRuleAssociationsServerTransport { - return &DataCollectionRuleAssociationsServerTransport{ - srv: srv, - newListByDataCollectionEndpointPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]](), - newListByResourcePager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]](), - newListByRulePager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]](), - } -} - -// DataCollectionRuleAssociationsServerTransport connects instances of armmonitor.DataCollectionRuleAssociationsClient to instances of DataCollectionRuleAssociationsServer. -// Don't use this type directly, use NewDataCollectionRuleAssociationsServerTransport instead. -type DataCollectionRuleAssociationsServerTransport struct { - srv *DataCollectionRuleAssociationsServer - newListByDataCollectionEndpointPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]] - newListByResourcePager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]] - newListByRulePager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionRuleAssociationsServerTransport. -func (d *DataCollectionRuleAssociationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionRuleAssociationsClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionRuleAssociationsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionRuleAssociationsClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager": - resp, err = d.dispatchNewListByDataCollectionEndpointPager(req) - case "DataCollectionRuleAssociationsClient.NewListByResourcePager": - resp, err = d.dispatchNewListByResourcePager(req) - case "DataCollectionRuleAssociationsClient.NewListByRulePager": - resp, err = d.dispatchNewListByRulePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleAssociationProxyOnlyResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRuleAssociationsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceURIParam, associationNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleAssociationProxyOnlyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceURIParam, associationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, associationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleAssociationProxyOnlyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByDataCollectionEndpointPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByDataCollectionEndpointPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByDataCollectionEndpointPager not implemented")} - } - newListByDataCollectionEndpointPager := d.newListByDataCollectionEndpointPager.get(req) - if newListByDataCollectionEndpointPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByDataCollectionEndpointPager(resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - newListByDataCollectionEndpointPager = &resp - d.newListByDataCollectionEndpointPager.add(req, newListByDataCollectionEndpointPager) - server.PagerResponderInjectNextLinks(newListByDataCollectionEndpointPager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByDataCollectionEndpointPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByDataCollectionEndpointPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByDataCollectionEndpointPager) { - d.newListByDataCollectionEndpointPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByResourcePager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourcePager not implemented")} - } - newListByResourcePager := d.newListByResourcePager.get(req) - if newListByResourcePager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourcePager(resourceURIParam, nil) - newListByResourcePager = &resp - d.newListByResourcePager.add(req, newListByResourcePager) - server.PagerResponderInjectNextLinks(newListByResourcePager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourcePager) { - d.newListByResourcePager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByRulePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByRulePager not implemented")} - } - newListByRulePager := d.newListByRulePager.get(req) - if newListByRulePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByRulePager(resourceGroupNameParam, dataCollectionRuleNameParam, nil) - newListByRulePager = &resp - d.newListByRulePager.add(req, newListByRulePager) - server.PagerResponderInjectNextLinks(newListByRulePager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByRulePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByRulePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByRulePager) { - d.newListByRulePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go deleted file mode 100644 index 5def3e9fc4e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go +++ /dev/null @@ -1,327 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionRulesServer is a fake server for instances of the armmonitor.DataCollectionRulesClient type. -type DataCollectionRulesServer struct { - // Create is the fake for method DataCollectionRulesClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionRulesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method DataCollectionRulesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.DataCollectionRulesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method DataCollectionRulesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.DataCollectionRulesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]) - - // Update is the fake for method DataCollectionRulesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewDataCollectionRulesServerTransport creates a new instance of DataCollectionRulesServerTransport with the provided implementation. -// The returned DataCollectionRulesServerTransport instance is connected to an instance of armmonitor.DataCollectionRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionRulesServerTransport(srv *DataCollectionRulesServer) *DataCollectionRulesServerTransport { - return &DataCollectionRulesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]](), - } -} - -// DataCollectionRulesServerTransport connects instances of armmonitor.DataCollectionRulesClient to instances of DataCollectionRulesServer. -// Don't use this type directly, use NewDataCollectionRulesServerTransport instead. -type DataCollectionRulesServerTransport struct { - srv *DataCollectionRulesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionRulesServerTransport. -func (d *DataCollectionRulesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionRulesClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionRulesClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionRulesClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionRulesClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DataCollectionRulesClient.NewListBySubscriptionPager": - resp, err = d.dispatchNewListBySubscriptionPager(req) - case "DataCollectionRulesClient.Update": - resp, err = d.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRulesClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRulesClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := d.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - d.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.DataCollectionRulesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - d.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.DataCollectionRulesClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - d.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if d.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRulesClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRulesClientUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go deleted file mode 100644 index 0ad7741d47d1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// DiagnosticSettingsServer is a fake server for instances of the armmonitor.DiagnosticSettingsClient type. -type DiagnosticSettingsServer struct { - // CreateOrUpdate is the fake for method DiagnosticSettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceURI string, name string, parameters armmonitor.DiagnosticSettingsResource, options *armmonitor.DiagnosticSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DiagnosticSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsClientDeleteOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DiagnosticSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsClientGetOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DiagnosticSettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.DiagnosticSettingsClientListOptions) (resp azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]) -} - -// NewDiagnosticSettingsServerTransport creates a new instance of DiagnosticSettingsServerTransport with the provided implementation. -// The returned DiagnosticSettingsServerTransport instance is connected to an instance of armmonitor.DiagnosticSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDiagnosticSettingsServerTransport(srv *DiagnosticSettingsServer) *DiagnosticSettingsServerTransport { - return &DiagnosticSettingsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]](), - } -} - -// DiagnosticSettingsServerTransport connects instances of armmonitor.DiagnosticSettingsClient to instances of DiagnosticSettingsServer. -// Don't use this type directly, use NewDiagnosticSettingsServerTransport instead. -type DiagnosticSettingsServerTransport struct { - srv *DiagnosticSettingsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]] -} - -// Do implements the policy.Transporter interface for DiagnosticSettingsServerTransport. -func (d *DiagnosticSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DiagnosticSettingsClient.CreateOrUpdate": - resp, err = d.dispatchCreateOrUpdate(req) - case "DiagnosticSettingsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DiagnosticSettingsClient.Get": - resp, err = d.dispatchGet(req) - case "DiagnosticSettingsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if d.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DiagnosticSettingsResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.CreateOrUpdate(req.Context(), resourceURIParam, nameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go deleted file mode 100644 index 70bbd473227a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go +++ /dev/null @@ -1,144 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// DiagnosticSettingsCategoryServer is a fake server for instances of the armmonitor.DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryServer struct { - // Get is the fake for method DiagnosticSettingsCategoryClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsCategoryClientGetOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsCategoryClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DiagnosticSettingsCategoryClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.DiagnosticSettingsCategoryClientListOptions) (resp azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]) -} - -// NewDiagnosticSettingsCategoryServerTransport creates a new instance of DiagnosticSettingsCategoryServerTransport with the provided implementation. -// The returned DiagnosticSettingsCategoryServerTransport instance is connected to an instance of armmonitor.DiagnosticSettingsCategoryClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDiagnosticSettingsCategoryServerTransport(srv *DiagnosticSettingsCategoryServer) *DiagnosticSettingsCategoryServerTransport { - return &DiagnosticSettingsCategoryServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]](), - } -} - -// DiagnosticSettingsCategoryServerTransport connects instances of armmonitor.DiagnosticSettingsCategoryClient to instances of DiagnosticSettingsCategoryServer. -// Don't use this type directly, use NewDiagnosticSettingsCategoryServerTransport instead. -type DiagnosticSettingsCategoryServerTransport struct { - srv *DiagnosticSettingsCategoryServer - newListPager *tracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]] -} - -// Do implements the policy.Transporter interface for DiagnosticSettingsCategoryServerTransport. -func (d *DiagnosticSettingsCategoryServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DiagnosticSettingsCategoryClient.Get": - resp, err = d.dispatchGet(req) - case "DiagnosticSettingsCategoryClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DiagnosticSettingsCategoryServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettingsCategories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsCategoryResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsCategoryServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettingsCategories` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go deleted file mode 100644 index a7e0402664b4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// EventCategoriesServer is a fake server for instances of the armmonitor.EventCategoriesClient type. -type EventCategoriesServer struct { - // NewListPager is the fake for method EventCategoriesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.EventCategoriesClientListOptions) (resp azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]) -} - -// NewEventCategoriesServerTransport creates a new instance of EventCategoriesServerTransport with the provided implementation. -// The returned EventCategoriesServerTransport instance is connected to an instance of armmonitor.EventCategoriesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewEventCategoriesServerTransport(srv *EventCategoriesServer) *EventCategoriesServerTransport { - return &EventCategoriesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]](), - } -} - -// EventCategoriesServerTransport connects instances of armmonitor.EventCategoriesClient to instances of EventCategoriesServer. -// Don't use this type directly, use NewEventCategoriesServerTransport instead. -type EventCategoriesServerTransport struct { - srv *EventCategoriesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]] -} - -// Do implements the policy.Transporter interface for EventCategoriesServerTransport. -func (e *EventCategoriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "EventCategoriesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *EventCategoriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - resp := e.srv.NewListPager(nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/internal.go b/sdk/resourcemanager/monitor/armmonitor/fake/internal.go index c63abf57927c..4b65adc76adb 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/internal.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/internal.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -11,10 +8,14 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" - "reflect" "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -32,32 +33,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func getHeaderValue(h http.Header, k string) string { - v := h[k] - if len(v) == 0 { - return "" - } - return v[0] -} - -func getOptional[T any](v T) *T { - if reflect.ValueOf(v).IsZero() { - return nil - } - return &v -} - -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go deleted file mode 100644 index f3c16afbcafe..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go +++ /dev/null @@ -1,249 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// LogProfilesServer is a fake server for instances of the armmonitor.LogProfilesClient type. -type LogProfilesServer struct { - // CreateOrUpdate is the fake for method LogProfilesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, logProfileName string, parameters armmonitor.LogProfileResource, options *armmonitor.LogProfilesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.LogProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method LogProfilesClient.Delete - // HTTP status codes to indicate success: http.StatusOK - Delete func(ctx context.Context, logProfileName string, options *armmonitor.LogProfilesClientDeleteOptions) (resp azfake.Responder[armmonitor.LogProfilesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method LogProfilesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, logProfileName string, options *armmonitor.LogProfilesClientGetOptions) (resp azfake.Responder[armmonitor.LogProfilesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method LogProfilesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.LogProfilesClientListOptions) (resp azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]) - - // Update is the fake for method LogProfilesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, logProfileName string, logProfilesResource armmonitor.LogProfileResourcePatch, options *armmonitor.LogProfilesClientUpdateOptions) (resp azfake.Responder[armmonitor.LogProfilesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewLogProfilesServerTransport creates a new instance of LogProfilesServerTransport with the provided implementation. -// The returned LogProfilesServerTransport instance is connected to an instance of armmonitor.LogProfilesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewLogProfilesServerTransport(srv *LogProfilesServer) *LogProfilesServerTransport { - return &LogProfilesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]](), - } -} - -// LogProfilesServerTransport connects instances of armmonitor.LogProfilesClient to instances of LogProfilesServer. -// Don't use this type directly, use NewLogProfilesServerTransport instead. -type LogProfilesServerTransport struct { - srv *LogProfilesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]] -} - -// Do implements the policy.Transporter interface for LogProfilesServerTransport. -func (l *LogProfilesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "LogProfilesClient.CreateOrUpdate": - resp, err = l.dispatchCreateOrUpdate(req) - case "LogProfilesClient.Delete": - resp, err = l.dispatchDelete(req) - case "LogProfilesClient.Get": - resp, err = l.dispatchGet(req) - case "LogProfilesClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - case "LogProfilesClient.Update": - resp, err = l.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if l.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResource](req) - if err != nil { - return nil, err - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.CreateOrUpdate(req.Context(), logProfileNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if l.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Delete(req.Context(), logProfileNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if l.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Get(req.Context(), logProfileNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if l.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := l.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := l.srv.NewListPager(nil) - newListPager = &resp - l.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - l.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - l.newListPager.remove(req) - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if l.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResourcePatch](req) - if err != nil { - return nil, err - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Update(req.Context(), logProfileNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go deleted file mode 100644 index a4eb7345ea8e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go +++ /dev/null @@ -1,307 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricAlertsServer is a fake server for instances of the armmonitor.MetricAlertsClient type. -type MetricAlertsServer struct { - // CreateOrUpdate is the fake for method MetricAlertsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.MetricAlertResource, options *armmonitor.MetricAlertsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method MetricAlertsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsClientDeleteOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method MetricAlertsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsClientGetOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method MetricAlertsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.MetricAlertsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method MetricAlertsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.MetricAlertsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]) - - // Update is the fake for method MetricAlertsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.MetricAlertResourcePatch, options *armmonitor.MetricAlertsClientUpdateOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewMetricAlertsServerTransport creates a new instance of MetricAlertsServerTransport with the provided implementation. -// The returned MetricAlertsServerTransport instance is connected to an instance of armmonitor.MetricAlertsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricAlertsServerTransport(srv *MetricAlertsServer) *MetricAlertsServerTransport { - return &MetricAlertsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]](), - } -} - -// MetricAlertsServerTransport connects instances of armmonitor.MetricAlertsClient to instances of MetricAlertsServer. -// Don't use this type directly, use NewMetricAlertsServerTransport instead. -type MetricAlertsServerTransport struct { - srv *MetricAlertsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for MetricAlertsServerTransport. -func (m *MetricAlertsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricAlertsClient.CreateOrUpdate": - resp, err = m.dispatchCreateOrUpdate(req) - case "MetricAlertsClient.Delete": - resp, err = m.dispatchDelete(req) - case "MetricAlertsClient.Get": - resp, err = m.dispatchGet(req) - case "MetricAlertsClient.NewListByResourceGroupPager": - resp, err = m.dispatchNewListByResourceGroupPager(req) - case "MetricAlertsClient.NewListBySubscriptionPager": - resp, err = m.dispatchNewListBySubscriptionPager(req) - case "MetricAlertsClient.Update": - resp, err = m.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if m.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if m.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - m.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := m.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := m.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - m.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - m.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if m.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go deleted file mode 100644 index 35302dcce43a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricAlertsStatusServer is a fake server for instances of the armmonitor.MetricAlertsStatusClient type. -type MetricAlertsStatusServer struct { - // List is the fake for method MetricAlertsStatusClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsStatusClientListOptions) (resp azfake.Responder[armmonitor.MetricAlertsStatusClientListResponse], errResp azfake.ErrorResponder) - - // ListByName is the fake for method MetricAlertsStatusClient.ListByName - // HTTP status codes to indicate success: http.StatusOK - ListByName func(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *armmonitor.MetricAlertsStatusClientListByNameOptions) (resp azfake.Responder[armmonitor.MetricAlertsStatusClientListByNameResponse], errResp azfake.ErrorResponder) -} - -// NewMetricAlertsStatusServerTransport creates a new instance of MetricAlertsStatusServerTransport with the provided implementation. -// The returned MetricAlertsStatusServerTransport instance is connected to an instance of armmonitor.MetricAlertsStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricAlertsStatusServerTransport(srv *MetricAlertsStatusServer) *MetricAlertsStatusServerTransport { - return &MetricAlertsStatusServerTransport{srv: srv} -} - -// MetricAlertsStatusServerTransport connects instances of armmonitor.MetricAlertsStatusClient to instances of MetricAlertsStatusServer. -// Don't use this type directly, use NewMetricAlertsStatusServerTransport instead. -type MetricAlertsStatusServerTransport struct { - srv *MetricAlertsStatusServer -} - -// Do implements the policy.Transporter interface for MetricAlertsStatusServerTransport. -func (m *MetricAlertsStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricAlertsStatusClient.List": - resp, err = m.dispatchList(req) - case "MetricAlertsStatusClient.ListByName": - resp, err = m.dispatchListByName(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricAlertsStatusServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if m.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/status` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.List(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertStatusCollection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsStatusServerTransport) dispatchListByName(req *http.Request) (*http.Response, error) { - if m.srv.ListByName == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByName not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/status/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - statusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("statusName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.ListByName(req.Context(), resourceGroupNameParam, ruleNameParam, statusNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertStatusCollection, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go deleted file mode 100644 index afd3650b01e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go +++ /dev/null @@ -1,170 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricDefinitionsServer is a fake server for instances of the armmonitor.MetricDefinitionsClient type. -type MetricDefinitionsServer struct { - // NewListPager is the fake for method MetricDefinitionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.MetricDefinitionsClientListOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]) - - // NewListAtSubscriptionScopePager is the fake for method MetricDefinitionsClient.NewListAtSubscriptionScopePager - // HTTP status codes to indicate success: http.StatusOK - NewListAtSubscriptionScopePager func(region string, options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]) -} - -// NewMetricDefinitionsServerTransport creates a new instance of MetricDefinitionsServerTransport with the provided implementation. -// The returned MetricDefinitionsServerTransport instance is connected to an instance of armmonitor.MetricDefinitionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricDefinitionsServerTransport(srv *MetricDefinitionsServer) *MetricDefinitionsServerTransport { - return &MetricDefinitionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]](), - newListAtSubscriptionScopePager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]](), - } -} - -// MetricDefinitionsServerTransport connects instances of armmonitor.MetricDefinitionsClient to instances of MetricDefinitionsServer. -// Don't use this type directly, use NewMetricDefinitionsServerTransport instead. -type MetricDefinitionsServerTransport struct { - srv *MetricDefinitionsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]] - newListAtSubscriptionScopePager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]] -} - -// Do implements the policy.Transporter interface for MetricDefinitionsServerTransport. -func (m *MetricDefinitionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricDefinitionsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "MetricDefinitionsClient.NewListAtSubscriptionScopePager": - resp, err = m.dispatchNewListAtSubscriptionScopePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := m.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - m.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - m.newListPager.remove(req) - } - return resp, nil -} - -func (m *MetricDefinitionsServerTransport) dispatchNewListAtSubscriptionScopePager(req *http.Request) (*http.Response, error) { - if m.srv.NewListAtSubscriptionScopePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAtSubscriptionScopePager not implemented")} - } - newListAtSubscriptionScopePager := m.newListAtSubscriptionScopePager.get(req) - if newListAtSubscriptionScopePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListAtSubscriptionScopePager(regionParam, options) - newListAtSubscriptionScopePager = &resp - m.newListAtSubscriptionScopePager.add(req, newListAtSubscriptionScopePager) - } - resp, err := server.PagerResponderNext(newListAtSubscriptionScopePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListAtSubscriptionScopePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListAtSubscriptionScopePager) { - m.newListAtSubscriptionScopePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go deleted file mode 100644 index 5ba4bd337806..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricNamespacesServer is a fake server for instances of the armmonitor.MetricNamespacesClient type. -type MetricNamespacesServer struct { - // NewListPager is the fake for method MetricNamespacesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.MetricNamespacesClientListOptions) (resp azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]) -} - -// NewMetricNamespacesServerTransport creates a new instance of MetricNamespacesServerTransport with the provided implementation. -// The returned MetricNamespacesServerTransport instance is connected to an instance of armmonitor.MetricNamespacesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricNamespacesServerTransport(srv *MetricNamespacesServer) *MetricNamespacesServerTransport { - return &MetricNamespacesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]](), - } -} - -// MetricNamespacesServerTransport connects instances of armmonitor.MetricNamespacesClient to instances of MetricNamespacesServer. -// Don't use this type directly, use NewMetricNamespacesServerTransport instead. -type MetricNamespacesServerTransport struct { - srv *MetricNamespacesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]] -} - -// Do implements the policy.Transporter interface for MetricNamespacesServerTransport. -func (m *MetricNamespacesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricNamespacesClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := m.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/metricNamespaces` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - startTimeUnescaped, err := url.QueryUnescape(qp.Get("startTime")) - if err != nil { - return nil, err - } - startTimeParam := getOptional(startTimeUnescaped) - var options *armmonitor.MetricNamespacesClientListOptions - if startTimeParam != nil { - options = &armmonitor.MetricNamespacesClientListOptions{ - StartTime: startTimeParam, - } - } - resp := m.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - m.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - m.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go deleted file mode 100644 index 32e178fddda3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go +++ /dev/null @@ -1,434 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" - "strconv" -) - -// MetricsServer is a fake server for instances of the armmonitor.MetricsClient type. -type MetricsServer struct { - // List is the fake for method MetricsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceURI string, options *armmonitor.MetricsClientListOptions) (resp azfake.Responder[armmonitor.MetricsClientListResponse], errResp azfake.ErrorResponder) - - // ListAtSubscriptionScope is the fake for method MetricsClient.ListAtSubscriptionScope - // HTTP status codes to indicate success: http.StatusOK - ListAtSubscriptionScope func(ctx context.Context, region string, options *armmonitor.MetricsClientListAtSubscriptionScopeOptions) (resp azfake.Responder[armmonitor.MetricsClientListAtSubscriptionScopeResponse], errResp azfake.ErrorResponder) - - // ListAtSubscriptionScopePost is the fake for method MetricsClient.ListAtSubscriptionScopePost - // HTTP status codes to indicate success: http.StatusOK - ListAtSubscriptionScopePost func(ctx context.Context, region string, options *armmonitor.MetricsClientListAtSubscriptionScopePostOptions) (resp azfake.Responder[armmonitor.MetricsClientListAtSubscriptionScopePostResponse], errResp azfake.ErrorResponder) -} - -// NewMetricsServerTransport creates a new instance of MetricsServerTransport with the provided implementation. -// The returned MetricsServerTransport instance is connected to an instance of armmonitor.MetricsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricsServerTransport(srv *MetricsServer) *MetricsServerTransport { - return &MetricsServerTransport{srv: srv} -} - -// MetricsServerTransport connects instances of armmonitor.MetricsClient to instances of MetricsServer. -// Don't use this type directly, use NewMetricsServerTransport instead. -type MetricsServerTransport struct { - srv *MetricsServer -} - -// Do implements the policy.Transporter interface for MetricsServerTransport. -func (m *MetricsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricsClient.List": - resp, err = m.dispatchList(req) - case "MetricsClient.ListAtSubscriptionScope": - resp, err = m.dispatchListAtSubscriptionScope(req) - case "MetricsClient.ListAtSubscriptionScopePost": - resp, err = m.dispatchListAtSubscriptionScopePost(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if m.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.ResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { - options = &armmonitor.MetricsClientListOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - } - } - respr, errRespr := m.srv.List(req.Context(), resourceURIParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Request) (*http.Response, error) { - if m.srv.ListAtSubscriptionScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAtSubscriptionScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.MetricResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListAtSubscriptionScopeOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { - options = &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - } - } - respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.Request) (*http.Response, error) { - if m.srv.ListAtSubscriptionScopePost == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAtSubscriptionScopePost not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armmonitor.SubscriptionScopeMetricsRequestBodyParameters](req) - if err != nil { - return nil, err - } - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.MetricResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListAtSubscriptionScopePostOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - Body: &body, - } - } - respr, errRespr := m.srv.ListAtSubscriptionScopePost(req.Context(), regionParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go deleted file mode 100644 index 3f4ae743691f..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// OperationsServer is a fake server for instances of the armmonitor.OperationsClient type. -type OperationsServer struct { - // List is the fake for method OperationsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armmonitor.OperationsClientListOptions) (resp azfake.Responder[armmonitor.OperationsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armmonitor.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{srv: srv} -} - -// OperationsServerTransport connects instances of armmonitor.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsClient.List": - resp, err = o.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if o.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - respr, errRespr := o.srv.List(req.Context(), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go deleted file mode 100644 index 7139e7b074ac..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// OperationsForMonitorServer is a fake server for instances of the armmonitor.OperationsForMonitorClient type. -type OperationsForMonitorServer struct { - // NewListPager is the fake for method OperationsForMonitorClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.OperationsForMonitorClientListOptions) (resp azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]) -} - -// NewOperationsForMonitorServerTransport creates a new instance of OperationsForMonitorServerTransport with the provided implementation. -// The returned OperationsForMonitorServerTransport instance is connected to an instance of armmonitor.OperationsForMonitorClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsForMonitorServerTransport(srv *OperationsForMonitorServer) *OperationsForMonitorServerTransport { - return &OperationsForMonitorServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]](), - } -} - -// OperationsForMonitorServerTransport connects instances of armmonitor.OperationsForMonitorClient to instances of OperationsForMonitorServer. -// Don't use this type directly, use NewOperationsForMonitorServerTransport instead. -type OperationsForMonitorServerTransport struct { - srv *OperationsForMonitorServer - newListPager *tracker[azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsForMonitorServerTransport. -func (o *OperationsForMonitorServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsForMonitorClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsForMonitorServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.OperationsForMonitorClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go deleted file mode 100644 index 2bceeeeb5b2a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go +++ /dev/null @@ -1,121 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PredictiveMetricServer is a fake server for instances of the armmonitor.PredictiveMetricClient type. -type PredictiveMetricServer struct { - // Get is the fake for method PredictiveMetricClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *armmonitor.PredictiveMetricClientGetOptions) (resp azfake.Responder[armmonitor.PredictiveMetricClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPredictiveMetricServerTransport creates a new instance of PredictiveMetricServerTransport with the provided implementation. -// The returned PredictiveMetricServerTransport instance is connected to an instance of armmonitor.PredictiveMetricClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPredictiveMetricServerTransport(srv *PredictiveMetricServer) *PredictiveMetricServerTransport { - return &PredictiveMetricServerTransport{srv: srv} -} - -// PredictiveMetricServerTransport connects instances of armmonitor.PredictiveMetricClient to instances of PredictiveMetricServer. -// Don't use this type directly, use NewPredictiveMetricServerTransport instead. -type PredictiveMetricServerTransport struct { - srv *PredictiveMetricServer -} - -// Do implements the policy.Transporter interface for PredictiveMetricServerTransport. -func (p *PredictiveMetricServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PredictiveMetricClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/predictiveMetrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - timespanParam, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - intervalParam, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - metricNamespaceParam, err := url.QueryUnescape(qp.Get("metricNamespace")) - if err != nil { - return nil, err - } - metricNameParam, err := url.QueryUnescape(qp.Get("metricName")) - if err != nil { - return nil, err - } - aggregationParam, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, timespanParam, intervalParam, metricNamespaceParam, metricNameParam, aggregationParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PredictiveResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go deleted file mode 100644 index 7c92dd7db08d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go +++ /dev/null @@ -1,261 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointConnectionsServer is a fake server for instances of the armmonitor.PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsServer struct { - // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnection, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *armmonitor.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *armmonitor.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armmonitor.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) - - // ListByPrivateLinkScope is the fake for method PrivateEndpointConnectionsClient.ListByPrivateLinkScope - // HTTP status codes to indicate success: http.StatusOK - ListByPrivateLinkScope func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (resp azfake.Responder[armmonitor.PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armmonitor.PrivateEndpointConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { - return &PrivateEndpointConnectionsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse]](), - } -} - -// PrivateEndpointConnectionsServerTransport connects instances of armmonitor.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. -// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. -type PrivateEndpointConnectionsServerTransport struct { - srv *PrivateEndpointConnectionsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse]] -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. -func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.ListByPrivateLinkScope": - resp, err = p.dispatchListByPrivateLinkScope(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - p.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - p.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchListByPrivateLinkScope(req *http.Request) (*http.Response, error) { - if p.srv.ListByPrivateLinkScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByPrivateLinkScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByPrivateLinkScope(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go deleted file mode 100644 index 5aff24a0df43..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkResourcesServer is a fake server for instances of the armmonitor.PrivateLinkResourcesClient type. -type PrivateLinkResourcesServer struct { - // Get is the fake for method PrivateLinkResourcesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *armmonitor.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) - - // ListByPrivateLinkScope is the fake for method PrivateLinkResourcesClient.ListByPrivateLinkScope - // HTTP status codes to indicate success: http.StatusOK - ListByPrivateLinkScope func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (resp azfake.Responder[armmonitor.PrivateLinkResourcesClientListByPrivateLinkScopeResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. -// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armmonitor.PrivateLinkResourcesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { - return &PrivateLinkResourcesServerTransport{srv: srv} -} - -// PrivateLinkResourcesServerTransport connects instances of armmonitor.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. -// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. -type PrivateLinkResourcesServerTransport struct { - srv *PrivateLinkResourcesServer -} - -// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. -func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourcesClient.ListByPrivateLinkScope": - resp, err = p.dispatchListByPrivateLinkScope(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkResourcesServerTransport) dispatchListByPrivateLinkScope(req *http.Request) (*http.Response, error) { - if p.srv.ListByPrivateLinkScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByPrivateLinkScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByPrivateLinkScope(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go deleted file mode 100644 index ca595081aa3e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go +++ /dev/null @@ -1,272 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopedResourcesServer is a fake server for instances of the armmonitor.PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesServer struct { - // BeginCreateOrUpdate is the fake for method PrivateLinkScopedResourcesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters armmonitor.ScopedResource, options *armmonitor.PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateLinkScopedResourcesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, name string, options *armmonitor.PrivateLinkScopedResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateLinkScopedResourcesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, name string, options *armmonitor.PrivateLinkScopedResourcesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopedResourcesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByPrivateLinkScopePager is the fake for method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager - // HTTP status codes to indicate success: http.StatusOK - NewListByPrivateLinkScopePager func(resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]) -} - -// NewPrivateLinkScopedResourcesServerTransport creates a new instance of PrivateLinkScopedResourcesServerTransport with the provided implementation. -// The returned PrivateLinkScopedResourcesServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopedResourcesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopedResourcesServerTransport(srv *PrivateLinkScopedResourcesServer) *PrivateLinkScopedResourcesServerTransport { - return &PrivateLinkScopedResourcesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse]](), - newListByPrivateLinkScopePager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]](), - } -} - -// PrivateLinkScopedResourcesServerTransport connects instances of armmonitor.PrivateLinkScopedResourcesClient to instances of PrivateLinkScopedResourcesServer. -// Don't use this type directly, use NewPrivateLinkScopedResourcesServerTransport instead. -type PrivateLinkScopedResourcesServerTransport struct { - srv *PrivateLinkScopedResourcesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse]] - newListByPrivateLinkScopePager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]] -} - -// Do implements the policy.Transporter interface for PrivateLinkScopedResourcesServerTransport. -func (p *PrivateLinkScopedResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopedResourcesClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateLinkScopedResourcesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateLinkScopedResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager": - resp, err = p.dispatchNewListByPrivateLinkScopePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ScopedResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { - p.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - p.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScopedResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLinkScopePager(req *http.Request) (*http.Response, error) { - if p.srv.NewListByPrivateLinkScopePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByPrivateLinkScopePager not implemented")} - } - newListByPrivateLinkScopePager := p.newListByPrivateLinkScopePager.get(req) - if newListByPrivateLinkScopePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListByPrivateLinkScopePager(resourceGroupNameParam, scopeNameParam, nil) - newListByPrivateLinkScopePager = &resp - p.newListByPrivateLinkScopePager.add(req, newListByPrivateLinkScopePager) - server.PagerResponderInjectNextLinks(newListByPrivateLinkScopePager, req, func(page *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByPrivateLinkScopePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListByPrivateLinkScopePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByPrivateLinkScopePager) { - p.newListByPrivateLinkScopePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go deleted file mode 100644 index c446302a7e6d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopeOperationStatusServer is a fake server for instances of the armmonitor.PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusServer struct { - // Get is the fake for method PrivateLinkScopeOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, asyncOperationID string, resourceGroupName string, options *armmonitor.PrivateLinkScopeOperationStatusClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopeOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkScopeOperationStatusServerTransport creates a new instance of PrivateLinkScopeOperationStatusServerTransport with the provided implementation. -// The returned PrivateLinkScopeOperationStatusServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopeOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopeOperationStatusServerTransport(srv *PrivateLinkScopeOperationStatusServer) *PrivateLinkScopeOperationStatusServerTransport { - return &PrivateLinkScopeOperationStatusServerTransport{srv: srv} -} - -// PrivateLinkScopeOperationStatusServerTransport connects instances of armmonitor.PrivateLinkScopeOperationStatusClient to instances of PrivateLinkScopeOperationStatusServer. -// Don't use this type directly, use NewPrivateLinkScopeOperationStatusServerTransport instead. -type PrivateLinkScopeOperationStatusServerTransport struct { - srv *PrivateLinkScopeOperationStatusServer -} - -// Do implements the policy.Transporter interface for PrivateLinkScopeOperationStatusServerTransport. -func (p *PrivateLinkScopeOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopeOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopeOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopeOperationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), asyncOperationIDParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go deleted file mode 100644 index bfd667894d9d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go +++ /dev/null @@ -1,327 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopesServer is a fake server for instances of the armmonitor.PrivateLinkScopesClient type. -type PrivateLinkScopesServer struct { - // CreateOrUpdate is the fake for method PrivateLinkScopesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload armmonitor.AzureMonitorPrivateLinkScope, options *armmonitor.PrivateLinkScopesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateLinkScopesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateLinkScopesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PrivateLinkScopesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.PrivateLinkScopesClientListOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]) - - // NewListByResourceGroupPager is the fake for method PrivateLinkScopesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.PrivateLinkScopesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]) - - // UpdateTags is the fake for method PrivateLinkScopesClient.UpdateTags - // HTTP status codes to indicate success: http.StatusOK - UpdateTags func(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags armmonitor.TagsResource, options *armmonitor.PrivateLinkScopesClientUpdateTagsOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientUpdateTagsResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkScopesServerTransport creates a new instance of PrivateLinkScopesServerTransport with the provided implementation. -// The returned PrivateLinkScopesServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopesServerTransport(srv *PrivateLinkScopesServer) *PrivateLinkScopesServerTransport { - return &PrivateLinkScopesServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]](), - } -} - -// PrivateLinkScopesServerTransport connects instances of armmonitor.PrivateLinkScopesClient to instances of PrivateLinkScopesServer. -// Don't use this type directly, use NewPrivateLinkScopesServerTransport instead. -type PrivateLinkScopesServerTransport struct { - srv *PrivateLinkScopesServer - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]] -} - -// Do implements the policy.Transporter interface for PrivateLinkScopesServerTransport. -func (p *PrivateLinkScopesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopesClient.CreateOrUpdate": - resp, err = p.dispatchCreateOrUpdate(req) - case "PrivateLinkScopesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateLinkScopesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkScopesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateLinkScopesClient.NewListByResourceGroupPager": - resp, err = p.dispatchNewListByResourceGroupPager(req) - case "PrivateLinkScopesClient.UpdateTags": - resp, err = p.dispatchUpdateTags(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorPrivateLinkScope](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := p.srv.NewListPager(nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.PrivateLinkScopesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.PrivateLinkScopesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - p.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { - if p.srv.UpdateTags == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.TagsResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.UpdateTags(req.Context(), resourceGroupNameParam, scopeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go index e38302e2c008..cf64352d5b2a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -76,31 +73,50 @@ func (s *ScheduledQueryRulesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScheduledQueryRulesClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "ScheduledQueryRulesClient.Delete": - resp, err = s.dispatchDelete(req) - case "ScheduledQueryRulesClient.Get": - resp, err = s.dispatchGet(req) - case "ScheduledQueryRulesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "ScheduledQueryRulesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "ScheduledQueryRulesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScheduledQueryRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if scheduledQueryRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scheduledQueryRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScheduledQueryRulesClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ScheduledQueryRulesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "ScheduledQueryRulesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScheduledQueryRulesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "ScheduledQueryRulesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "ScheduledQueryRulesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ScheduledQueryRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -312,3 +328,9 @@ func (s *ScheduledQueryRulesServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to ScheduledQueryRulesServerTransport +var scheduledQueryRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go index 17116edbbb23..7054790c7d97 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -19,38 +16,11 @@ import ( // ServerFactory is a fake server for instances of the armmonitor.ClientFactory type. type ServerFactory struct { - ActionGroupsServer ActionGroupsServer - ActivityLogAlertsServer ActivityLogAlertsServer - ActivityLogsServer ActivityLogsServer - AlertRuleIncidentsServer AlertRuleIncidentsServer - AlertRulesServer AlertRulesServer - AutoscaleSettingsServer AutoscaleSettingsServer - AzureMonitorWorkspacesServer AzureMonitorWorkspacesServer - BaselinesServer BaselinesServer - DataCollectionEndpointsServer DataCollectionEndpointsServer - DataCollectionRuleAssociationsServer DataCollectionRuleAssociationsServer - DataCollectionRulesServer DataCollectionRulesServer - DiagnosticSettingsCategoryServer DiagnosticSettingsCategoryServer - DiagnosticSettingsServer DiagnosticSettingsServer - EventCategoriesServer EventCategoriesServer - LogProfilesServer LogProfilesServer - MetricAlertsServer MetricAlertsServer - MetricAlertsStatusServer MetricAlertsStatusServer - MetricDefinitionsServer MetricDefinitionsServer - MetricNamespacesServer MetricNamespacesServer - MetricsServer MetricsServer - OperationsServer OperationsServer - OperationsForMonitorServer OperationsForMonitorServer - PredictiveMetricServer PredictiveMetricServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - PrivateLinkScopeOperationStatusServer PrivateLinkScopeOperationStatusServer - PrivateLinkScopedResourcesServer PrivateLinkScopedResourcesServer - PrivateLinkScopesServer PrivateLinkScopesServer - ScheduledQueryRulesServer ScheduledQueryRulesServer - TenantActionGroupsServer TenantActionGroupsServer - TenantActivityLogsServer TenantActivityLogsServer - VMInsightsServer VMInsightsServer + // ActionGroupsServer contains the fakes for client ActionGroupsClient + ActionGroupsServer ActionGroupsServer + + // ScheduledQueryRulesServer contains the fakes for client ScheduledQueryRulesClient + ScheduledQueryRulesServer ScheduledQueryRulesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -65,40 +35,10 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armmonitor.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trActionGroupsServer *ActionGroupsServerTransport - trActivityLogAlertsServer *ActivityLogAlertsServerTransport - trActivityLogsServer *ActivityLogsServerTransport - trAlertRuleIncidentsServer *AlertRuleIncidentsServerTransport - trAlertRulesServer *AlertRulesServerTransport - trAutoscaleSettingsServer *AutoscaleSettingsServerTransport - trAzureMonitorWorkspacesServer *AzureMonitorWorkspacesServerTransport - trBaselinesServer *BaselinesServerTransport - trDataCollectionEndpointsServer *DataCollectionEndpointsServerTransport - trDataCollectionRuleAssociationsServer *DataCollectionRuleAssociationsServerTransport - trDataCollectionRulesServer *DataCollectionRulesServerTransport - trDiagnosticSettingsCategoryServer *DiagnosticSettingsCategoryServerTransport - trDiagnosticSettingsServer *DiagnosticSettingsServerTransport - trEventCategoriesServer *EventCategoriesServerTransport - trLogProfilesServer *LogProfilesServerTransport - trMetricAlertsServer *MetricAlertsServerTransport - trMetricAlertsStatusServer *MetricAlertsStatusServerTransport - trMetricDefinitionsServer *MetricDefinitionsServerTransport - trMetricNamespacesServer *MetricNamespacesServerTransport - trMetricsServer *MetricsServerTransport - trOperationsServer *OperationsServerTransport - trOperationsForMonitorServer *OperationsForMonitorServerTransport - trPredictiveMetricServer *PredictiveMetricServerTransport - trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport - trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport - trPrivateLinkScopeOperationStatusServer *PrivateLinkScopeOperationStatusServerTransport - trPrivateLinkScopedResourcesServer *PrivateLinkScopedResourcesServerTransport - trPrivateLinkScopesServer *PrivateLinkScopesServerTransport - trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport - trTenantActionGroupsServer *TenantActionGroupsServerTransport - trTenantActivityLogsServer *TenantActivityLogsServerTransport - trVMInsightsServer *VMInsightsServerTransport + srv *ServerFactory + trMu sync.Mutex + trActionGroupsServer *ActionGroupsServerTransport + trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -117,145 +57,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ActionGroupsClient": initServer(s, &s.trActionGroupsServer, func() *ActionGroupsServerTransport { return NewActionGroupsServerTransport(&s.srv.ActionGroupsServer) }) resp, err = s.trActionGroupsServer.Do(req) - case "ActivityLogAlertsClient": - initServer(s, &s.trActivityLogAlertsServer, func() *ActivityLogAlertsServerTransport { - return NewActivityLogAlertsServerTransport(&s.srv.ActivityLogAlertsServer) - }) - resp, err = s.trActivityLogAlertsServer.Do(req) - case "ActivityLogsClient": - initServer(s, &s.trActivityLogsServer, func() *ActivityLogsServerTransport { return NewActivityLogsServerTransport(&s.srv.ActivityLogsServer) }) - resp, err = s.trActivityLogsServer.Do(req) - case "AlertRuleIncidentsClient": - initServer(s, &s.trAlertRuleIncidentsServer, func() *AlertRuleIncidentsServerTransport { - return NewAlertRuleIncidentsServerTransport(&s.srv.AlertRuleIncidentsServer) - }) - resp, err = s.trAlertRuleIncidentsServer.Do(req) - case "AlertRulesClient": - initServer(s, &s.trAlertRulesServer, func() *AlertRulesServerTransport { return NewAlertRulesServerTransport(&s.srv.AlertRulesServer) }) - resp, err = s.trAlertRulesServer.Do(req) - case "AutoscaleSettingsClient": - initServer(s, &s.trAutoscaleSettingsServer, func() *AutoscaleSettingsServerTransport { - return NewAutoscaleSettingsServerTransport(&s.srv.AutoscaleSettingsServer) - }) - resp, err = s.trAutoscaleSettingsServer.Do(req) - case "AzureMonitorWorkspacesClient": - initServer(s, &s.trAzureMonitorWorkspacesServer, func() *AzureMonitorWorkspacesServerTransport { - return NewAzureMonitorWorkspacesServerTransport(&s.srv.AzureMonitorWorkspacesServer) - }) - resp, err = s.trAzureMonitorWorkspacesServer.Do(req) - case "BaselinesClient": - initServer(s, &s.trBaselinesServer, func() *BaselinesServerTransport { return NewBaselinesServerTransport(&s.srv.BaselinesServer) }) - resp, err = s.trBaselinesServer.Do(req) - case "DataCollectionEndpointsClient": - initServer(s, &s.trDataCollectionEndpointsServer, func() *DataCollectionEndpointsServerTransport { - return NewDataCollectionEndpointsServerTransport(&s.srv.DataCollectionEndpointsServer) - }) - resp, err = s.trDataCollectionEndpointsServer.Do(req) - case "DataCollectionRuleAssociationsClient": - initServer(s, &s.trDataCollectionRuleAssociationsServer, func() *DataCollectionRuleAssociationsServerTransport { - return NewDataCollectionRuleAssociationsServerTransport(&s.srv.DataCollectionRuleAssociationsServer) - }) - resp, err = s.trDataCollectionRuleAssociationsServer.Do(req) - case "DataCollectionRulesClient": - initServer(s, &s.trDataCollectionRulesServer, func() *DataCollectionRulesServerTransport { - return NewDataCollectionRulesServerTransport(&s.srv.DataCollectionRulesServer) - }) - resp, err = s.trDataCollectionRulesServer.Do(req) - case "DiagnosticSettingsCategoryClient": - initServer(s, &s.trDiagnosticSettingsCategoryServer, func() *DiagnosticSettingsCategoryServerTransport { - return NewDiagnosticSettingsCategoryServerTransport(&s.srv.DiagnosticSettingsCategoryServer) - }) - resp, err = s.trDiagnosticSettingsCategoryServer.Do(req) - case "DiagnosticSettingsClient": - initServer(s, &s.trDiagnosticSettingsServer, func() *DiagnosticSettingsServerTransport { - return NewDiagnosticSettingsServerTransport(&s.srv.DiagnosticSettingsServer) - }) - resp, err = s.trDiagnosticSettingsServer.Do(req) - case "EventCategoriesClient": - initServer(s, &s.trEventCategoriesServer, func() *EventCategoriesServerTransport { - return NewEventCategoriesServerTransport(&s.srv.EventCategoriesServer) - }) - resp, err = s.trEventCategoriesServer.Do(req) - case "LogProfilesClient": - initServer(s, &s.trLogProfilesServer, func() *LogProfilesServerTransport { return NewLogProfilesServerTransport(&s.srv.LogProfilesServer) }) - resp, err = s.trLogProfilesServer.Do(req) - case "MetricAlertsClient": - initServer(s, &s.trMetricAlertsServer, func() *MetricAlertsServerTransport { return NewMetricAlertsServerTransport(&s.srv.MetricAlertsServer) }) - resp, err = s.trMetricAlertsServer.Do(req) - case "MetricAlertsStatusClient": - initServer(s, &s.trMetricAlertsStatusServer, func() *MetricAlertsStatusServerTransport { - return NewMetricAlertsStatusServerTransport(&s.srv.MetricAlertsStatusServer) - }) - resp, err = s.trMetricAlertsStatusServer.Do(req) - case "MetricDefinitionsClient": - initServer(s, &s.trMetricDefinitionsServer, func() *MetricDefinitionsServerTransport { - return NewMetricDefinitionsServerTransport(&s.srv.MetricDefinitionsServer) - }) - resp, err = s.trMetricDefinitionsServer.Do(req) - case "MetricNamespacesClient": - initServer(s, &s.trMetricNamespacesServer, func() *MetricNamespacesServerTransport { - return NewMetricNamespacesServerTransport(&s.srv.MetricNamespacesServer) - }) - resp, err = s.trMetricNamespacesServer.Do(req) - case "MetricsClient": - initServer(s, &s.trMetricsServer, func() *MetricsServerTransport { return NewMetricsServerTransport(&s.srv.MetricsServer) }) - resp, err = s.trMetricsServer.Do(req) - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) - case "OperationsForMonitorClient": - initServer(s, &s.trOperationsForMonitorServer, func() *OperationsForMonitorServerTransport { - return NewOperationsForMonitorServerTransport(&s.srv.OperationsForMonitorServer) - }) - resp, err = s.trOperationsForMonitorServer.Do(req) - case "PredictiveMetricClient": - initServer(s, &s.trPredictiveMetricServer, func() *PredictiveMetricServerTransport { - return NewPredictiveMetricServerTransport(&s.srv.PredictiveMetricServer) - }) - resp, err = s.trPredictiveMetricServer.Do(req) - case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { - return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) - }) - resp, err = s.trPrivateEndpointConnectionsServer.Do(req) - case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { - return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) - }) - resp, err = s.trPrivateLinkResourcesServer.Do(req) - case "PrivateLinkScopeOperationStatusClient": - initServer(s, &s.trPrivateLinkScopeOperationStatusServer, func() *PrivateLinkScopeOperationStatusServerTransport { - return NewPrivateLinkScopeOperationStatusServerTransport(&s.srv.PrivateLinkScopeOperationStatusServer) - }) - resp, err = s.trPrivateLinkScopeOperationStatusServer.Do(req) - case "PrivateLinkScopedResourcesClient": - initServer(s, &s.trPrivateLinkScopedResourcesServer, func() *PrivateLinkScopedResourcesServerTransport { - return NewPrivateLinkScopedResourcesServerTransport(&s.srv.PrivateLinkScopedResourcesServer) - }) - resp, err = s.trPrivateLinkScopedResourcesServer.Do(req) - case "PrivateLinkScopesClient": - initServer(s, &s.trPrivateLinkScopesServer, func() *PrivateLinkScopesServerTransport { - return NewPrivateLinkScopesServerTransport(&s.srv.PrivateLinkScopesServer) - }) - resp, err = s.trPrivateLinkScopesServer.Do(req) case "ScheduledQueryRulesClient": initServer(s, &s.trScheduledQueryRulesServer, func() *ScheduledQueryRulesServerTransport { return NewScheduledQueryRulesServerTransport(&s.srv.ScheduledQueryRulesServer) }) resp, err = s.trScheduledQueryRulesServer.Do(req) - case "TenantActionGroupsClient": - initServer(s, &s.trTenantActionGroupsServer, func() *TenantActionGroupsServerTransport { - return NewTenantActionGroupsServerTransport(&s.srv.TenantActionGroupsServer) - }) - resp, err = s.trTenantActionGroupsServer.Do(req) - case "TenantActivityLogsClient": - initServer(s, &s.trTenantActivityLogsServer, func() *TenantActivityLogsServerTransport { - return NewTenantActivityLogsServerTransport(&s.srv.TenantActivityLogsServer) - }) - resp, err = s.trTenantActivityLogsServer.Do(req) - case "VMInsightsClient": - initServer(s, &s.trVMInsightsServer, func() *VMInsightsServerTransport { return NewVMInsightsServerTransport(&s.srv.VMInsightsServer) }) - resp, err = s.trVMInsightsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go deleted file mode 100644 index 961b93e78ba9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// TenantActionGroupsServer is a fake server for instances of the armmonitor.TenantActionGroupsClient type. -type TenantActionGroupsServer struct { - // CreateOrUpdate is the fake for method TenantActionGroupsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup armmonitor.TenantActionGroupResource, options *armmonitor.TenantActionGroupsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method TenantActionGroupsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientDeleteOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TenantActionGroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientGetOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByManagementGroupIDPager is the fake for method TenantActionGroupsClient.NewListByManagementGroupIDPager - // HTTP status codes to indicate success: http.StatusOK - NewListByManagementGroupIDPager func(managementGroupID string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientListByManagementGroupIDOptions) (resp azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]) - - // Update is the fake for method TenantActionGroupsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch armmonitor.ActionGroupPatchBodyAutoGenerated, options *armmonitor.TenantActionGroupsClientUpdateOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTenantActionGroupsServerTransport creates a new instance of TenantActionGroupsServerTransport with the provided implementation. -// The returned TenantActionGroupsServerTransport instance is connected to an instance of armmonitor.TenantActionGroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTenantActionGroupsServerTransport(srv *TenantActionGroupsServer) *TenantActionGroupsServerTransport { - return &TenantActionGroupsServerTransport{ - srv: srv, - newListByManagementGroupIDPager: newTracker[azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]](), - } -} - -// TenantActionGroupsServerTransport connects instances of armmonitor.TenantActionGroupsClient to instances of TenantActionGroupsServer. -// Don't use this type directly, use NewTenantActionGroupsServerTransport instead. -type TenantActionGroupsServerTransport struct { - srv *TenantActionGroupsServer - newListByManagementGroupIDPager *tracker[azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]] -} - -// Do implements the policy.Transporter interface for TenantActionGroupsServerTransport. -func (t *TenantActionGroupsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TenantActionGroupsClient.CreateOrUpdate": - resp, err = t.dispatchCreateOrUpdate(req) - case "TenantActionGroupsClient.Delete": - resp, err = t.dispatchDelete(req) - case "TenantActionGroupsClient.Get": - resp, err = t.dispatchGet(req) - case "TenantActionGroupsClient.NewListByManagementGroupIDPager": - resp, err = t.dispatchNewListByManagementGroupIDPager(req) - case "TenantActionGroupsClient.Update": - resp, err = t.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if t.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.TenantActionGroupResource](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.CreateOrUpdate(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if t.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Delete(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchNewListByManagementGroupIDPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListByManagementGroupIDPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByManagementGroupIDPager not implemented")} - } - newListByManagementGroupIDPager := t.newListByManagementGroupIDPager.get(req) - if newListByManagementGroupIDPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListByManagementGroupIDPager(managementGroupIDParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - newListByManagementGroupIDPager = &resp - t.newListByManagementGroupIDPager.add(req, newListByManagementGroupIDPager) - } - resp, err := server.PagerResponderNext(newListByManagementGroupIDPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListByManagementGroupIDPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByManagementGroupIDPager) { - t.newListByManagementGroupIDPager.remove(req) - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if t.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ActionGroupPatchBodyAutoGenerated](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Update(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go deleted file mode 100644 index f8ea81901bf1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" -) - -// TenantActivityLogsServer is a fake server for instances of the armmonitor.TenantActivityLogsClient type. -type TenantActivityLogsServer struct { - // NewListPager is the fake for method TenantActivityLogsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.TenantActivityLogsClientListOptions) (resp azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]) -} - -// NewTenantActivityLogsServerTransport creates a new instance of TenantActivityLogsServerTransport with the provided implementation. -// The returned TenantActivityLogsServerTransport instance is connected to an instance of armmonitor.TenantActivityLogsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTenantActivityLogsServerTransport(srv *TenantActivityLogsServer) *TenantActivityLogsServerTransport { - return &TenantActivityLogsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]](), - } -} - -// TenantActivityLogsServerTransport connects instances of armmonitor.TenantActivityLogsClient to instances of TenantActivityLogsServer. -// Don't use this type directly, use NewTenantActivityLogsServerTransport instead. -type TenantActivityLogsServerTransport struct { - srv *TenantActivityLogsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]] -} - -// Do implements the policy.Transporter interface for TenantActivityLogsServerTransport. -func (t *TenantActivityLogsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TenantActivityLogsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - selectUnescaped, err := url.QueryUnescape(qp.Get("$select")) - if err != nil { - return nil, err - } - selectParam := getOptional(selectUnescaped) - var options *armmonitor.TenantActivityLogsClientListOptions - if filterParam != nil || selectParam != nil { - options = &armmonitor.TenantActivityLogsClientListOptions{ - Filter: filterParam, - Select: selectParam, - } - } - resp := t.srv.NewListPager(options) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.TenantActivityLogsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go deleted file mode 100644 index 3080daf9560a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go +++ /dev/null @@ -1,155 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go deleted file mode 100644 index 58c4f55c2452..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// VMInsightsServer is a fake server for instances of the armmonitor.VMInsightsClient type. -type VMInsightsServer struct { - // GetOnboardingStatus is the fake for method VMInsightsClient.GetOnboardingStatus - // HTTP status codes to indicate success: http.StatusOK - GetOnboardingStatus func(ctx context.Context, resourceURI string, options *armmonitor.VMInsightsClientGetOnboardingStatusOptions) (resp azfake.Responder[armmonitor.VMInsightsClientGetOnboardingStatusResponse], errResp azfake.ErrorResponder) -} - -// NewVMInsightsServerTransport creates a new instance of VMInsightsServerTransport with the provided implementation. -// The returned VMInsightsServerTransport instance is connected to an instance of armmonitor.VMInsightsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVMInsightsServerTransport(srv *VMInsightsServer) *VMInsightsServerTransport { - return &VMInsightsServerTransport{srv: srv} -} - -// VMInsightsServerTransport connects instances of armmonitor.VMInsightsClient to instances of VMInsightsServer. -// Don't use this type directly, use NewVMInsightsServerTransport instead. -type VMInsightsServerTransport struct { - srv *VMInsightsServer -} - -// Do implements the policy.Transporter interface for VMInsightsServerTransport. -func (v *VMInsightsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "VMInsightsClient.GetOnboardingStatus": - resp, err = v.dispatchGetOnboardingStatus(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VMInsightsServerTransport) dispatchGetOnboardingStatus(req *http.Request) (*http.Response, error) { - if v.srv.GetOnboardingStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOnboardingStatus not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/vmInsightsOnboardingStatuses/default` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.GetOnboardingStatus(req.Context(), resourceURIParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMInsightsOnboardingStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index da2cf1e7b01a..10f6e87f783a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -4,7 +4,6 @@ go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect diff --git a/sdk/resourcemanager/monitor/armmonitor/interfaces.go b/sdk/resourcemanager/monitor/armmonitor/interfaces.go deleted file mode 100644 index df55091d31a6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/interfaces.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -// MetricAlertCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetMetricAlertCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *MetricAlertCriteria, *MetricAlertMultipleResourceMultipleMetricCriteria, *MetricAlertSingleResourceMultipleMetricCriteria, -// - *WebtestLocationAvailabilityCriteria -type MetricAlertCriteriaClassification interface { - // GetMetricAlertCriteria returns the MetricAlertCriteria content of the underlying type. - GetMetricAlertCriteria() *MetricAlertCriteria -} - -// MultiMetricCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetMultiMetricCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DynamicMetricCriteria, *MetricCriteria, *MultiMetricCriteria -type MultiMetricCriteriaClassification interface { - // GetMultiMetricCriteria returns the MultiMetricCriteria content of the underlying type. - GetMultiMetricCriteria() *MultiMetricCriteria -} - -// RuleActionClassification provides polymorphic access to related types. -// Call the interface's GetRuleAction() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RuleAction, *RuleEmailAction, *RuleWebhookAction -type RuleActionClassification interface { - // GetRuleAction returns the RuleAction content of the underlying type. - GetRuleAction() *RuleAction -} - -// RuleConditionClassification provides polymorphic access to related types. -// Call the interface's GetRuleCondition() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LocationThresholdRuleCondition, *ManagementEventRuleCondition, *RuleCondition, *ThresholdRuleCondition -type RuleConditionClassification interface { - // GetRuleCondition returns the RuleCondition content of the underlying type. - GetRuleCondition() *RuleCondition -} - -// RuleDataSourceClassification provides polymorphic access to related types. -// Call the interface's GetRuleDataSource() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RuleDataSource, *RuleManagementEventDataSource, *RuleMetricDataSource -type RuleDataSourceClassification interface { - // GetRuleDataSource returns the RuleDataSource content of the underlying type. - GetRuleDataSource() *RuleDataSource -} diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go deleted file mode 100644 index f8042d17921a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go +++ /dev/null @@ -1,333 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// LogProfilesClient contains the methods for the LogProfiles group. -// Don't use this type directly, use NewLogProfilesClient() instead. -type LogProfilesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewLogProfilesClient creates a new instance of LogProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogProfilesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &LogProfilesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update a log profile in Azure Monitoring REST API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - parameters - Parameters supplied to the operation. -// - options - LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate -// method. -func (client *LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (LogProfilesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "LogProfilesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, logProfileName, parameters, options) - if err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *LogProfilesClient) createOrUpdateCreateRequest(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *LogProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (LogProfilesClientCreateOrUpdateResponse, error) { - result := LogProfilesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the log profile. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - options - LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. -func (client *LogProfilesClient) Delete(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (LogProfilesClientDeleteResponse, error) { - var err error - const operationName = "LogProfilesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, logProfileName, options) - if err != nil { - return LogProfilesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientDeleteResponse{}, err - } - return LogProfilesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *LogProfilesClient) deleteCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Gets the log profile. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - options - LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. -func (client *LogProfilesClient) Get(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (LogProfilesClientGetResponse, error) { - var err error - const operationName = "LogProfilesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, logProfileName, options) - if err != nil { - return LogProfilesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *LogProfilesClient) getCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *LogProfilesClient) getHandleResponse(resp *http.Response) (LogProfilesClientGetResponse, error) { - result := LogProfilesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List the log profiles. -// -// Generated from API version 2016-03-01 -// - options - LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. -func (client *LogProfilesClient) NewListPager(options *LogProfilesClientListOptions) *runtime.Pager[LogProfilesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[LogProfilesClientListResponse]{ - More: func(page LogProfilesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *LogProfilesClientListResponse) (LogProfilesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LogProfilesClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return LogProfilesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LogProfilesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *LogProfilesClient) listCreateRequest(ctx context.Context, options *LogProfilesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *LogProfilesClient) listHandleResponse(resp *http.Response) (LogProfilesClientListResponse, error) { - result := LogProfilesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileCollection); err != nil { - return LogProfilesClientListResponse{}, err - } - return result, nil -} - -// Update - Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - logProfilesResource - Parameters supplied to the operation. -// - options - LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. -func (client *LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (LogProfilesClientUpdateResponse, error) { - var err error - const operationName = "LogProfilesClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, logProfileName, logProfilesResource, options) - if err != nil { - return LogProfilesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, logProfilesResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *LogProfilesClient) updateHandleResponse(resp *http.Response) (LogProfilesClientUpdateResponse, error) { - result := LogProfilesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go deleted file mode 100644 index 66b0efcdbaae..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json -func ExampleLogProfilesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json -func ExampleLogProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Get(ctx, "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json -func ExampleLogProfilesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResource{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json -func ExampleLogProfilesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Update(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResourcePatch{ - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json -func ExampleLogProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogProfilesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogProfileCollection = armmonitor.LogProfileCollection{ - // Value: []*armmonitor.LogProfileResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // }, - // { - // Name: to.Ptr("default2"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](15), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go deleted file mode 100644 index fbc981a3dcf3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricAlertsClient contains the methods for the MetricAlerts group. -// Don't use this type directly, use NewMetricAlertsClient() instead. -type MetricAlertsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricAlertsClient creates a new instance of MetricAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricAlertsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update an metric alert definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to create or update. -// - options - MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate -// method. -func (client *MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, options *MetricAlertsClientCreateOrUpdateOptions) (MetricAlertsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "MetricAlertsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) - if err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *MetricAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, options *MetricAlertsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *MetricAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (MetricAlertsClientCreateOrUpdateResponse, error) { - result := MetricAlertsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an alert rule definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. -func (client *MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientDeleteOptions) (MetricAlertsClientDeleteResponse, error) { - var err error - const operationName = "MetricAlertsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientDeleteResponse{}, err - } - return MetricAlertsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *MetricAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Retrieve an alert rule definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. -func (client *MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientGetOptions) (MetricAlertsClientGetResponse, error) { - var err error - const operationName = "MetricAlertsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MetricAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MetricAlertsClient) getHandleResponse(resp *http.Response) (MetricAlertsClientGetResponse, error) { - result := MetricAlertsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Retrieve alert rule definitions in a resource group. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager -// method. -func (client *MetricAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *MetricAlertsClientListByResourceGroupOptions) *runtime.Pager[MetricAlertsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListByResourceGroupResponse]{ - More: func(page MetricAlertsClientListByResourceGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricAlertsClientListByResourceGroupResponse) (MetricAlertsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricAlertsClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *MetricAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MetricAlertsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *MetricAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (MetricAlertsClientListByResourceGroupResponse, error) { - result := MetricAlertsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Retrieve alert rule definitions in a subscription. -// -// Generated from API version 2018-03-01 -// - options - MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager -// method. -func (client *MetricAlertsClient) NewListBySubscriptionPager(options *MetricAlertsClientListBySubscriptionOptions) *runtime.Pager[MetricAlertsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListBySubscriptionResponse]{ - More: func(page MetricAlertsClientListBySubscriptionResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricAlertsClientListBySubscriptionResponse) (MetricAlertsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricAlertsClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, options) - if err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Context, options *MetricAlertsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *MetricAlertsClient) listBySubscriptionHandleResponse(resp *http.Response) (MetricAlertsClientListBySubscriptionResponse, error) { - result := MetricAlertsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Update an metric alert definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to update. -// - options - MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. -func (client *MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (MetricAlertsClientUpdateResponse, error) { - var err error - const operationName = "MetricAlertsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) - if err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *MetricAlertsClient) updateHandleResponse(resp *http.Response) (MetricAlertsClientUpdateResponse, error) { - result := MetricAlertsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go deleted file mode 100644 index 6d1dd5eb5028..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ /dev/null @@ -1,1477 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json -func ExampleMetricAlertsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricAlertsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricAlertResourceCollection = armmonitor.MetricAlertResourceCollection{ - // Value: []*armmonitor.MetricAlertResource{ - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Med cpu alert"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("Medium_CPU_50"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](50.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json -func ExampleMetricAlertsClient_Get_getAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "rg-example", "webtest-name-example", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\""), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t }()), - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t}()), - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "rg-example", "webtest-name-example", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{ - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": to.Ptr("Resource"), - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": to.Ptr("Resource"), - }, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("Automatically created alert rule for availability test \"component-example\" a"), - Actions: []*armmonitor.MetricAlertAction{}, - Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"), - FailedLocationCount: to.Ptr[float32](2), - WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example")}, - Severity: to.Ptr[int32](4), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\" a"), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultipleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDimensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleDimensions", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("Metric1"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{ - { - Name: to.Ptr("ActivityName"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("*")}, - }, - { - Name: to.Ptr("StatusCode"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("200")}, - }}, - MetricName: to.Ptr("Availability"), - MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](55), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1H"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("P1D"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("Metric1"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // { - // Name: to.Ptr("ActivityName"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("*")}, - // }, - // { - // Name: to.Ptr("StatusCode"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("200")}, - // }}, - // MetricName: to.Ptr("Availability"), - // MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](55), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1H"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.KeyVault/vaults"), - // WindowSize: to.Ptr("P1D"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json -func ExampleMetricAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Update(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResourcePatch{ - Properties: &armmonitor.MetricAlertPropertiesPatch{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - Tags: map[string]*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json -func ExampleMetricAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetricAlertsClient().Delete(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go deleted file mode 100644 index 08919a9901e7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricAlertsStatusClient contains the methods for the MetricAlertsStatus group. -// Don't use this type directly, use NewMetricAlertsStatusClient() instead. -type MetricAlertsStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricAlertsStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - Retrieve an alert rule status. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. -func (client *MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsStatusClientListOptions) (MetricAlertsStatusClientListResponse, error) { - var err error - const operationName = "MetricAlertsStatusClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsStatusClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *MetricAlertsStatusClient) listCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsStatusClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricAlertsStatusClient) listHandleResponse(resp *http.Response) (MetricAlertsStatusClientListResponse, error) { - result := MetricAlertsStatusClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - return result, nil -} - -// ListByName - Retrieve an alert rule status. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - statusName - The name of the status. -// - options - MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName -// method. -func (client *MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (MetricAlertsStatusClientListByNameResponse, error) { - var err error - const operationName = "MetricAlertsStatusClient.ListByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByNameCreateRequest(ctx, resourceGroupName, ruleName, statusName, options) - if err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsStatusClientListByNameResponse{}, err - } - resp, err := client.listByNameHandleResponse(httpResp) - return resp, err -} - -// listByNameCreateRequest creates the ListByName request. -func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if statusName == "" { - return nil, errors.New("parameter statusName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{statusName}", url.PathEscape(statusName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNameHandleResponse handles the ListByName response. -func (client *MetricAlertsStatusClient) listByNameHandleResponse(resp *http.Response) (MetricAlertsStatusClientListByNameResponse, error) { - result := MetricAlertsStatusClientListByNameResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go deleted file mode 100644 index 1e773c902b9a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json -func ExampleMetricAlertsStatusClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().List(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json -func ExampleMetricAlertsStatusClient_ListByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().ListByName(ctx, "EastUs", "custom1", "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go deleted file mode 100644 index 0f7f6dc1ab0c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricDefinitionsClient contains the methods for the MetricDefinitions group. -// Don't use this type directly, use NewMetricDefinitionsClient() instead. -type MetricDefinitionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricDefinitionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric definitions for the resource. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. -// - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager -// method. -func (client *MetricDefinitionsClient) NewListPager(resourceURI string, options *MetricDefinitionsClientListOptions) *runtime.Pager[MetricDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListResponse]{ - More: func(page MetricDefinitionsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListResponse) (MetricDefinitionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricDefinitionsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) (MetricDefinitionsClientListResponse, error) { - result := MetricDefinitionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionCollection); err != nil { - return MetricDefinitionsClientListResponse{}, err - } - return result, nil -} - -// NewListAtSubscriptionScopePager - Lists the metric definitions for the subscription. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager -// method. -func (client *MetricDefinitionsClient) NewListAtSubscriptionScopePager(region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) *runtime.Pager[MetricDefinitionsClientListAtSubscriptionScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListAtSubscriptionScopeResponse]{ - More: func(page MetricDefinitionsClientListAtSubscriptionScopeResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListAtSubscriptionScopeResponse) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListAtSubscriptionScopePager") - req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listAtSubscriptionScopeHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. -func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. -func (client *MetricDefinitionsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { - result := MetricDefinitionsClientListAtSubscriptionScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricDefinitionCollection); err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go deleted file mode 100644 index 94630917f42d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ /dev/null @@ -1,7245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListAtSubscriptionScopePager("westus2", &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{Metricnamespace: to.Ptr("microsoft.compute/virtualmachines")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionScopeMetricDefinitionCollection = armmonitor.SubscriptionScopeMetricDefinitionCollection{ - // Value: []*armmonitor.SubscriptionScopeMetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Percentage CPU"), - // Value: to.Ptr("Percentage CPU"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The percentage of allocated compute units that are currently in use by the Virtual Machine(s)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Percentage CPU"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Billable (Deprecated)"), - // Value: to.Ptr("Network In"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Billable (Deprecated)"), - // Value: to.Ptr("Network Out"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Bytes"), - // Value: to.Ptr("Disk Read Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes read from disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Bytes"), - // Value: to.Ptr("Disk Write Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes written to disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Operations/Sec"), - // Value: to.Ptr("Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Read IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Operations/Sec"), - // Value: to.Ptr("Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Write IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Remaining"), - // Value: to.Ptr("CPU Credits Remaining"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits available to burst. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Remaining"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Consumed"), - // Value: to.Ptr("CPU Credits Consumed"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits consumed by the Virtual Machine. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Consumed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Bytes/Sec"), - // Value: to.Ptr("Data Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Operations/Sec"), - // Value: to.Ptr("Data Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Operations/Sec"), - // Value: to.Ptr("Data Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Queue Depth"), - // Value: to.Ptr("Data Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Data Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk IOPS Consumed Percentage"), - // Value: to.Ptr("Data Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target Bandwidth"), - // Value: to.Ptr("Data Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target IOPS"), - // Value: to.Ptr("Data Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst Bandwidth"), - // Value: to.Ptr("Data Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Bytes/Sec"), - // Value: to.Ptr("OS Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Bytes/Sec"), - // Value: to.Ptr("OS Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Operations/Sec"), - // Value: to.Ptr("OS Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Operations/Sec"), - // Value: to.Ptr("OS Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Queue Depth"), - // Value: to.Ptr("OS Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("OS Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk IOPS Consumed Percentage"), - // Value: to.Ptr("OS Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target Bandwidth"), - // Value: to.Ptr("OS Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target IOPS"), - // Value: to.Ptr("OS Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst Bandwidth"), - // Value: to.Ptr("OS Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst IOPS"), - // Value: to.Ptr("OS Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows"), - // Value: to.Ptr("Inbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Inbound Flows are number of current flows in the inbound direction (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows"), - // Value: to.Ptr("Outbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Outbound Flows are number of current flows in the outbound direction (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Inbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of inbound flows (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Outbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of outbound flows (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Hit"), - // Value: to.Ptr("Premium Data Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Miss"), - // Value: to.Ptr("Premium Data Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Hit"), - // Value: to.Ptr("Premium OS Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Miss"), - // Value: to.Ptr("Premium OS Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Cached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Total"), - // Value: to.Ptr("Network In Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Total"), - // Value: to.Ptr("Network Out Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsApplicationInsights.json -func ExampleMetricDefinitionsClient_NewListPager_getApplicationInsightsMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.insights/components")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability"), - // Value: to.Ptr("availabilityResults/availabilityPercentage"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }}, - // DisplayDescription: to.Ptr("Percentage of successfully completed availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/availabilityPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability tests"), - // Value: to.Ptr("availabilityResults/count"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Count of availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability test duration"), - // Value: to.Ptr("availabilityResults/duration"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Availability test duration"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page load network connect time"), - // Value: to.Ptr("browserTimings/networkDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between user request and network connection. Includes DNS lookup and transport connection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/networkDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client processing time"), - // Value: to.Ptr("browserTimings/processingDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between receiving the last byte of a document until the DOM is loaded. Async requests may still be processing."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/processingDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Receiving response time"), - // Value: to.Ptr("browserTimings/receiveDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between the first and last bytes, or until disconnection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/receiveDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Send request time"), - // Value: to.Ptr("browserTimings/sendDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between network connection and receiving the first byte."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/sendDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser page load time"), - // Value: to.Ptr("browserTimings/totalDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time from user request until DOM, stylesheets, scripts and images are loaded."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/totalDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency calls"), - // Value: to.Ptr("dependencies/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency duration"), - // Value: to.Ptr("dependencies/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Duration of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency call failures"), - // Value: to.Ptr("dependencies/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of failed dependency calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page views"), - // Value: to.Ptr("pageViews/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of page views."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page view load time"), - // Value: to.Ptr("pageViews/duration"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Page view load time"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request execution time"), - // Value: to.Ptr("performanceCounters/requestExecutionTime"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Execution time of the most recent request."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestExecutionTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP requests in application queue"), - // Value: to.Ptr("performanceCounters/requestsInQueue"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Length of the application request queue."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsInQueue"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request rate"), - // Value: to.Ptr("performanceCounters/requestsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Rate of all requests to the application per second from ASP.NET."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exception rate"), - // Value: to.Ptr("performanceCounters/exceptionsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of handled and unhandled exceptions reported to windows, including .NET exceptions and unmanaged exceptions that are converted into .NET exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/exceptionsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process IO rate"), - // Value: to.Ptr("performanceCounters/processIOBytesPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Total bytes per second read and written to files, network and devices."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processIOBytesPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process CPU"), - // Value: to.Ptr("performanceCounters/processCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of elapsed time that all process threads used the processor to execute instructions. This can vary between 0 to 100. This metric indicates the performance of w3wp process alone."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Processor time"), - // Value: to.Ptr("performanceCounters/processorCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of time that the processor spends in non-idle threads."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processorCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Available memory"), - // Value: to.Ptr("performanceCounters/memoryAvailableBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Physical memory immediately available for allocation to a process or for system use."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/memoryAvailableBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process private bytes"), - // Value: to.Ptr("performanceCounters/processPrivateBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Memory exclusively assigned to the monitored application's processes."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processPrivateBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server response time"), - // Value: to.Ptr("requests/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Time between receiving an HTTP request and finishing sending the response."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server requests"), - // Value: to.Ptr("requests/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests completed."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Failed requests"), - // Value: to.Ptr("requests/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests marked as failed. In most cases these are requests with a response code >= 400 and not equal to 401."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server request rate"), - // Value: to.Ptr("requests/rate"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Rate of server requests per second"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exceptions"), - // Value: to.Ptr("exceptions/count"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Device type"), - // Value: to.Ptr("client/type"), - // }}, - // DisplayDescription: to.Ptr("Combined count of all uncaught exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser exceptions"), - // Value: to.Ptr("exceptions/browser"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the browser."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/browser"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server exceptions"), - // Value: to.Ptr("exceptions/server"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the server application."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/server"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Traces"), - // Value: to.Ptr("traces/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Severity level"), - // Value: to.Ptr("trace/severityLevel"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Trace document count"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/traces/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("Microsoft.Web/sites")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Time"), - // Value: to.Ptr("CpuTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/CpuTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Requests"), - // Value: to.Ptr("Requests"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Requests"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data In"), - // Value: to.Ptr("BytesReceived"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesReceived"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Out"), - // Value: to.Ptr("BytesSent"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesSent"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 101"), - // Value: to.Ptr("Http101"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http101"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 2xx"), - // Value: to.Ptr("Http2xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http2xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 3xx"), - // Value: to.Ptr("Http3xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http3xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 401"), - // Value: to.Ptr("Http401"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http401"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 403"), - // Value: to.Ptr("Http403"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http403"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 404"), - // Value: to.Ptr("Http404"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http404"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 406"), - // Value: to.Ptr("Http406"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http406"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 4xx"), - // Value: to.Ptr("Http4xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http4xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http Server Errors"), - // Value: to.Ptr("Http5xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http5xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Memory working set"), - // Value: to.Ptr("MemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/MemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average memory working set"), - // Value: to.Ptr("AverageMemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageMemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Response Time"), - // Value: to.Ptr("AverageResponseTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageResponseTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsMetricClass.json -func ExampleMetricDefinitionsClient_NewListPager_getStorageCacheMetricDefinitionsWithMetricClass() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.storagecache/caches")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total Client IOPS"), - // Value: to.Ptr("ClientIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations processed by the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Client Latency"), - // Value: to.Ptr("ClientLatency"), - // }, - // DisplayDescription: to.Ptr("Average latency of client file operations to the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassLatency), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Read IOPS"), - // Value: to.Ptr("ClientReadIOPS"), - // }, - // DisplayDescription: to.Ptr("Client read operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Read Throughput"), - // Value: to.Ptr("ClientReadThroughput"), - // }, - // DisplayDescription: to.Ptr("Client read data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Write IOPS"), - // Value: to.Ptr("ClientWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("Client write operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Write Throughput"), - // Value: to.Ptr("ClientWriteThroughput"), - // }, - // DisplayDescription: to.Ptr("Client write data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Read IOPS"), - // Value: to.Ptr("ClientMetadataReadIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data reads, that do not modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Write IOPS"), - // Value: to.Ptr("ClientMetadataWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data writes, that modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Lock IOPS"), - // Value: to.Ptr("ClientLockIOPS"), - // }, - // DisplayDescription: to.Ptr("Client file locking operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLockIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Storage Target Health"), - // Value: to.Ptr("StorageTargetHealth"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and Storage Targets."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetHealth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassErrors), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Uptime"), - // Value: to.Ptr("Uptime"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and monitoring system."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/Uptime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassAvailability), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total StorageTarget IOPS"), - // Value: to.Ptr("StorageTargetIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of all file operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Write IOPS"), - // Value: to.Ptr("StorageTargetWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of the file write operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Asynchronous Write Throughput"), - // Value: to.Ptr("StorageTargetAsyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache asynchronously writes data to a particular StorageTarget. These are opportunistic writes that do not cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetAsyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Synchronous Write Throughput"), - // Value: to.Ptr("StorageTargetSyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache synchronously writes data to a particular StorageTarget. These are writes that do cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetSyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Write Throughput"), - // Value: to.Ptr("StorageTargetTotalWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache writes data to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Latency"), - // Value: to.Ptr("StorageTargetLatency"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The average round trip latency of all the file operations the Cache sends to a partricular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Read IOPS"), - // Value: to.Ptr("StorageTargetMetadataReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do not modify persistent state, and excluding the read operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Write IOPS"), - // Value: to.Ptr("StorageTargetMetadataWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do modify persistent state and excluding the write operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read IOPS"), - // Value: to.Ptr("StorageTargetReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file read operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read Ahead Throughput"), - // Value: to.Ptr("StorageTargetReadAheadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache opportunisticly reads data from the StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadAheadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Fill Throughput"), - // Value: to.Ptr("StorageTargetFillThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache reads data from the StorageTarget to handle a cache miss."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetFillThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Read Throughput"), - // Value: to.Ptr("StorageTargetTotalReadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache reads data from a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go deleted file mode 100644 index 2912562457a6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// MetricNamespacesClient contains the methods for the MetricNamespaces group. -// Don't use this type directly, use NewMetricNamespacesClient() instead. -type MetricNamespacesClient struct { - internal *arm.Client -} - -// NewMetricNamespacesClient creates a new instance of MetricNamespacesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricNamespacesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricNamespacesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric namespaces for the resource. -// -// Generated from API version 2017-12-01-preview -// - resourceURI - The identifier of the resource. -// - options - MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager -// method. -func (client *MetricNamespacesClient) NewListPager(resourceURI string, options *MetricNamespacesClientListOptions) *runtime.Pager[MetricNamespacesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricNamespacesClientListResponse]{ - More: func(page MetricNamespacesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricNamespacesClientListResponse) (MetricNamespacesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricNamespacesClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricNamespacesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricNamespacesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricNamespacesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *MetricNamespacesClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricNamespacesClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/microsoft.insights/metricNamespaces" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-12-01-preview") - if options != nil && options.StartTime != nil { - reqQP.Set("startTime", *options.StartTime) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricNamespacesClient) listHandleResponse(resp *http.Response) (MetricNamespacesClientListResponse, error) { - result := MetricNamespacesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricNamespaceCollection); err != nil { - return MetricNamespacesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go deleted file mode 100644 index 0ef141700996..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json -func ExampleMetricNamespacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{ - // Value: []*armmonitor.MetricNamespace{ - // { - // Name: to.Ptr("Azure.ApplicationInsights"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationCustom), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"), - // }, - // }, - // { - // Name: to.Ptr("microsoft.insights-components"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("microsoft.insights/components"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go deleted file mode 100644 index 97219fc6364d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ /dev/null @@ -1,317 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// MetricsClient contains the methods for the Metrics group. -// Don't use this type directly, use NewMetricsClient() instead. -type MetricsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricsClient creates a new instance of MetricsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - Lists the metric values for a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. -// - options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. -func (client *MetricsClient) List(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (MetricsClientListResponse, error) { - var err error - const operationName = "MetricsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metrics" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - reqQP.Set("api-version", "2021-05-01") - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsClientListResponse, error) { - result := MetricsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Response); err != nil { - return MetricsClientListResponse{}, err - } - return result, nil -} - -// ListAtSubscriptionScope - Lists the metric data for a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope -// method. -func (client *MetricsClient) ListAtSubscriptionScope(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (MetricsClientListAtSubscriptionScopeResponse, error) { - var err error - const operationName = "MetricsClient.ListAtSubscriptionScope" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) - if err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - resp, err := client.listAtSubscriptionScopeHandleResponse(httpResp) - return resp, err -} - -// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. -func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. -func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopeResponse, error) { - result := MetricsClientListAtSubscriptionScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - return result, nil -} - -// ListAtSubscriptionScopePost - Lists the metric data for a subscription. Parameters can be specified on either query params -// or the body. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost -// method. -func (client *MetricsClient) ListAtSubscriptionScopePost(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (MetricsClientListAtSubscriptionScopePostResponse, error) { - var err error - const operationName = "MetricsClient.ListAtSubscriptionScopePost" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAtSubscriptionScopePostCreateRequest(ctx, region, options) - if err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - resp, err := client.listAtSubscriptionScopePostHandleResponse(httpResp) - return resp, err -} - -// listAtSubscriptionScopePostCreateRequest creates the ListAtSubscriptionScopePost request. -func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listAtSubscriptionScopePostHandleResponse handles the ListAtSubscriptionScopePost response. -func (client *MetricsClient) listAtSubscriptionScopePostHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopePostResponse, error) { - result := MetricsClientListAtSubscriptionScopePostResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go deleted file mode 100644 index fc968d5cc26c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go +++ /dev/null @@ -1,1480 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetric.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: to.Ptr("count"), - Top: to.Ptr[int32](10), - Orderby: to.Ptr("count desc"), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricMetadata.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z"), - Interval: nil, - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("LUN eq '0'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Interval: to.Ptr("PT1M"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-10T02:23:16Z/2021-06-12T02:23:16Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Read Bytes/sec"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("0"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("1"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/PostMultiResourceMetricBody.json -func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricDataUsingBodyParams() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{Timespan: nil, - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: nil, - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - Body: &armmonitor.SubscriptionScopeMetricsRequestBodyParameters{ - Aggregation: to.Ptr("count"), - AutoAdjustTimegrain: to.Ptr(true), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - Interval: to.Ptr("PT6H"), - MetricNames: to.Ptr("Data Disk Max Burst IOPS"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - OrderBy: to.Ptr("count desc"), - RollUpBy: to.Ptr("LUN"), - Timespan: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "NaN-NaN-NaNTNaN:NaN:NaN.NaNZ"); return t }()), - Top: to.Ptr[int32](10), - ValidateDimensions: to.Ptr(false), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetric.json -func ExampleMetricsClient_List_getMetricForData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-04-20T09:00:00.000Z/2021-04-20T14:00:00.000Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("BlobCount,BlobCapacity"), - Aggregation: to.Ptr("average,minimum,maximum"), - Top: to.Ptr[int32](5), - Orderby: to.Ptr("average asc"), - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](598), - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-20T09:00:00Z/2021-04-20T14:00:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Capacity"), - // Value: to.Ptr("BlobCapacity"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The amount of storage used by the storage account’s Blob service in bytes."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitBytes), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricMetadata.json -func ExampleMetricsClient_List_getMetricForMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-15T02:18:00Z/2021-04-22T02:18:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricError.json -func ExampleMetricsClient_List_getMetricWithError() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - Interval: to.Ptr("FULL"), - Metricnames: to.Ptr("MongoRequestsCount,MongoRequests"), - Aggregation: to.Ptr("average"), - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](239), - // Interval: to.Ptr("PT4H"), - // Namespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("(deprecated) Mongo Request Rate"), - // Value: to.Ptr("MongoRequestsCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // ErrorCode: to.Ptr("InvalidSamplingType"), - // ErrorMessage: to.Ptr("Sampling type is not found. Metric:CosmosDBCustomer,AzureMonitor,MongoRequests, SamplingType:NullableAverage."), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequestsCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // }, - // Unit: to.Ptr(armmonitor.UnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Mongo Requests"), - // Value: to.Ptr("MongoRequests"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Number of Mongo Requests Made"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequests"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-07T21:51:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // }, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models.go b/sdk/resourcemanager/monitor/armmonitor/models.go index 5857358098d6..eca8948595fe 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -10,37 +7,6 @@ package armmonitor import "time" -// AccessModeSettings - Properties that define the scope private link mode settings. -type AccessModeSettings struct { - // REQUIRED; Specifies the default access mode of ingestion through associated private endpoints in scope. If not specified - // default value is 'Open'. You can override this default setting for a specific private - // endpoint connection by adding an exclusion in the 'exclusions' array. - IngestionAccessMode *AccessMode - - // REQUIRED; Specifies the default access mode of queries through associated private endpoints in scope. If not specified - // default value is 'Open'. You can override this default setting for a specific private - // endpoint connection by adding an exclusion in the 'exclusions' array. - QueryAccessMode *AccessMode - - // List of exclusions that override the default access mode settings for specific private endpoint connections. - Exclusions []*AccessModeSettingsExclusion -} - -// AccessModeSettingsExclusion - Properties that define the scope private link mode settings exclusion item. This setting -// applies to a specific private endpoint connection and overrides the default settings for that private endpoint -// connection. -type AccessModeSettingsExclusion struct { - // Specifies the access mode of ingestion through the specified private endpoint connection in the exclusion. - IngestionAccessMode *AccessMode - - // The private endpoint connection name associated to the private endpoint on which we want to apply the specific access mode - // settings. - PrivateEndpointConnectionName *string - - // Specifies the access mode of queries through the specified private endpoint connection in the exclusion. - QueryAccessMode *AccessMode -} - // ActionDetail - The action detail type ActionDetail struct { // The detail of the friendly error message @@ -90,6 +56,9 @@ type ActionGroup struct { // The list of event hub receivers that are part of this action group. EventHubReceivers []*EventHubReceiver + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver + // The list of ITSM receivers that are part of this action group. ItsmReceivers []*ItsmReceiver @@ -106,15 +75,6 @@ type ActionGroup struct { WebhookReceivers []*WebhookReceiver } -// ActionGroupAutoGenerated - A pointer to an Azure Action Group. -type ActionGroupAutoGenerated struct { - // REQUIRED; The resource ID of the Action Group. This cannot be null or empty. - ActionGroupID *string - - // the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string -} - // ActionGroupList - A list of action groups. type ActionGroupList struct { // Provides the link to retrieve the next set of elements. @@ -130,26 +90,13 @@ type ActionGroupPatch struct { Enabled *bool } -// ActionGroupPatchAutoGenerated - A tenant action group for patch operations. -type ActionGroupPatchAutoGenerated struct { - // Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of its actions - // will be activated. - Enabled *bool -} - // ActionGroupPatchBody - An action group object for the body of patch operations. type ActionGroupPatchBody struct { - // The action group settings for an update operation. - Properties *ActionGroupPatch - - // Resource tags - Tags map[string]*string -} + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity -// ActionGroupPatchBodyAutoGenerated - A tenant action group object for the body of patch operations. -type ActionGroupPatchBodyAutoGenerated struct { // The action group settings for an update operation. - Properties *ActionGroupPatchAutoGenerated + Properties *ActionGroupPatch // Resource tags Tags map[string]*string @@ -160,6 +107,9 @@ type ActionGroupResource struct { // REQUIRED; Resource location Location *string + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + // The action groups properties of the resource. Properties *ActionGroup @@ -176,198 +126,18 @@ type ActionGroupResource struct { Type *string } -// ActionList - A list of Activity Log Alert rule actions. -type ActionList struct { - // The list of the Action Groups. - ActionGroups []*ActionGroupAutoGenerated -} - // Actions to invoke when the alert fires. type Actions struct { // Action Group resource Ids to invoke when the alert fires. ActionGroups []*string + // The properties of an action properties. + ActionProperties map[string]*string + // The properties of an alert payload. CustomProperties map[string]*string } -// ActivityLogAlertResource - An Activity Log Alert rule resource. -type ActivityLogAlertResource struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. - Location *string - - // The Activity Log Alert rule properties of the resource. - Properties *AlertRuleProperties - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource Id. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; The type of the resource. - Type *string -} - -// AlertRule - An alert rule. -type AlertRule struct { - // REQUIRED; the condition that results in the alert rule being activated. - Condition RuleConditionClassification - - // REQUIRED; the flag that indicates whether the alert rule is enabled. - IsEnabled *bool - - // REQUIRED; the name of the alert rule. - Name *string - - // action that is performed when the alert rule becomes active, and when an alert condition is resolved. - Action RuleActionClassification - - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []RuleActionClassification - - // the description of the alert rule that will be included in the alert email. - Description *string - - // the provisioning state. - ProvisioningState *string - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// AlertRuleAllOfCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. -type AlertRuleAllOfCondition struct { - // REQUIRED; The list of Activity Log Alert rule conditions. - AllOf []*AlertRuleAnyOfOrLeafCondition -} - -// AlertRuleAnyOfOrLeafCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. -// Each condition can be of one of the following types:Important: Each type has its unique subset of properties. -// Properties from different types CANNOT exist in one condition. -// * Leaf Condition - must contain 'field' and either 'equals' or 'containsAny'.Please note, 'anyOf' should not be set in -// a Leaf Condition. -// * AnyOf Condition - must contain only 'anyOf' (which is an array of Leaf Conditions).Please note, 'field', 'equals' and -// 'containsAny' should not be set in an AnyOf Condition. -type AlertRuleAnyOfOrLeafCondition struct { - // An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. - AnyOf []*AlertRuleLeafCondition - - // The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition - // is met. - ContainsAny []*string - - // The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string - - // The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): - // 'resourceId', 'category', 'caller', 'level', 'operationName', - // 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. - Field *string -} - -// AlertRuleLeafCondition - An Activity Log Alert rule condition that is met by comparing the field and value of an Activity -// Log event. This condition must contain 'field' and either 'equals' or 'containsAny'. -type AlertRuleLeafCondition struct { - // The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition - // is met. - ContainsAny []*string - - // The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string - - // The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): - // 'resourceId', 'category', 'caller', 'level', 'operationName', - // 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. - Field *string -} - -// AlertRuleList - A list of Activity Log Alert rules. -type AlertRuleList struct { - // Provides the link to retrieve the next set of elements. - NextLink *string - - // The list of Activity Log Alert rules. - Value []*ActivityLogAlertResource -} - -// AlertRulePatchObject - An Activity Log Alert rule object for the body of patch operations. -type AlertRulePatchObject struct { - // The activity log alert settings for an update operation. - Properties *AlertRulePatchProperties - - // The resource tags - Tags map[string]*string -} - -// AlertRulePatchProperties - An Activity Log Alert rule properties for patch operations. -type AlertRulePatchProperties struct { - // Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its - // actions will be activated. - Enabled *bool -} - -// AlertRuleProperties - An Azure Activity Log Alert rule. -type AlertRuleProperties struct { - // REQUIRED; The actions that will activate when the condition is met. - Actions *ActionList - - // REQUIRED; The condition that will cause this alert to activate. - Condition *AlertRuleAllOfCondition - - // REQUIRED; A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource - // IDs that fall under one of these prefixes. This list must include at least one - // item. - Scopes []*string - - // A description of this Activity Log Alert rule. - Description *string - - // Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its - // actions will be activated. - Enabled *bool -} - -// AlertRuleResource - The alert rule resource. -type AlertRuleResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The alert rule properties of the resource. - Properties *AlertRule - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// AlertRuleResourceCollection - Represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - // the values for the alert rule resources. - Value []*AlertRuleResource -} - -// AlertRuleResourcePatch - The alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // The properties of an alert rule. - Properties *AlertRule - - // Resource tags - Tags map[string]*string -} - // ArmRoleReceiver - An arm role receiver. type ArmRoleReceiver struct { // REQUIRED; The name of the arm role receiver. Names must be unique across all receivers within an action group. @@ -394,6 +164,9 @@ type AutomationRunbookReceiver struct { // REQUIRED; The resource id for webhook linked to this runbook. WebhookResourceID *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + // Indicates name of the webhook. Name *string @@ -404,131 +177,6 @@ type AutomationRunbookReceiver struct { UseCommonAlertSchema *bool } -// AutoscaleErrorResponse - Describes the format of Error response. -type AutoscaleErrorResponse struct { - // The error object. - Error *AutoscaleErrorResponseError - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData -} - -// AutoscaleErrorResponseError - The error object. -type AutoscaleErrorResponseError struct { - // One of a server-defined set of error codes. - Code *string - - // A human-readable representation of the error's details. - Details *string - - // A human-readable representation of the error. - Message *string - - // The target of the particular error. - Target *string -} - -// AutoscaleNotification - Autoscale notification. -type AutoscaleNotification struct { - // CONSTANT; the operation associated with the notification and its value must be "scale" - // Field has constant value "Scale", any specified value is ignored. - Operation *string - - // the email notification. - Email *EmailNotification - - // the collection of webhook notifications. - Webhooks []*WebhookNotification -} - -// AutoscaleProfile - Autoscale profile. -type AutoscaleProfile struct { - // REQUIRED; the number of instances that can be used during this profile. - Capacity *ScaleCapacity - - // REQUIRED; the name of the profile. - Name *string - - // REQUIRED; the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules - // can be specified. - Rules []*ScaleRule - - // the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow - - // the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence -} - -// AutoscaleSetting - A setting that contains all of the configuration for the automatic scaling of a resource. -type AutoscaleSetting struct { - // REQUIRED; the collection of automatic scaling profiles that specify different scaling parameters for different time periods. - // A maximum of 20 profiles can be specified. - Profiles []*AutoscaleProfile - - // the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'. - Enabled *bool - - // the name of the autoscale setting. - Name *string - - // the collection of notifications. - Notifications []*AutoscaleNotification - - // the predictive autoscale policy mode. - PredictiveAutoscalePolicy *PredictiveAutoscalePolicy - - // the location of the resource that the autoscale setting should be added to. - TargetResourceLocation *string - - // the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string -} - -// AutoscaleSettingResource - The autoscale setting resource. -type AutoscaleSettingResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The autoscale setting of the resource. - Properties *AutoscaleSetting - - // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this - // resource (across resource groups). A maximum of 15 tags can be provided for a - // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData - - // READ-ONLY; Azure resource type - Type *string -} - -// AutoscaleSettingResourceCollection - Represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - // REQUIRED; the values for the autoscale setting resources. - Value []*AutoscaleSettingResource - - // URL to get the next set of results. - NextLink *string -} - -// AutoscaleSettingResourcePatch - The autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // The autoscale setting properties of the update operation. - Properties *AutoscaleSetting - - // Resource tags - Tags map[string]*string -} - // AzureAppPushReceiver - The Azure mobile App push notification receiver. type AzureAppPushReceiver struct { // REQUIRED; The email address registered for the Azure mobile app. @@ -538,16 +186,6 @@ type AzureAppPushReceiver struct { Name *string } -// AzureAppPushReceiverAutoGenerated - The Azure mobile App push notification receiver. -type AzureAppPushReceiverAutoGenerated struct { - // REQUIRED; The email address registered for the Azure mobile app. - EmailAddress *string - - // REQUIRED; The name of the Azure mobile app push receiver. Names must be unique across all receivers within a tenant action - // group. - Name *string -} - // AzureFunctionReceiver - An azure function receiver. type AzureFunctionReceiver struct { // REQUIRED; The azure resource id of the function app. @@ -562,380 +200,285 @@ type AzureFunctionReceiver struct { // REQUIRED; The name of the azure function receiver. Names must be unique across all receivers within an action group. Name *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + // Indicates whether to use common alert schema. UseCommonAlertSchema *bool } -// AzureMonitorMetricsDestination - Azure Monitor Metrics destination. -type AzureMonitorMetricsDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// AzureMonitorPrivateLinkScope - An Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - // REQUIRED; The geo-location where the resource lives +// AzureResource - An azure resource object +type AzureResource struct { + // REQUIRED; Resource location Location *string - // REQUIRED; Properties that define a Azure Monitor PrivateLinkScope resource. - Properties *AzureMonitorPrivateLinkScopeProperties + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity - // Resource tags. + // Resource tags Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Azure resource Id ID *string - // READ-ONLY; The name of the resource + // READ-ONLY; Azure resource name Name *string - // READ-ONLY; System data - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // READ-ONLY; Azure resource type Type *string } -// AzureMonitorPrivateLinkScopeListResult - Describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - // REQUIRED; List of Azure Monitor PrivateLinkScope definitions. - Value []*AzureMonitorPrivateLinkScope +// Condition - A condition of the scheduled query rule. +type Condition struct { + // The extent of deviation required to trigger an alert. Allowed values are 'Low', 'Medium' and 'High'. This will affect how + // tight the threshold is to the metric series pattern. Relevant only for dynamic + // threshold rules of the kind LogAlert. + AlertSensitivity *string - // The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned - // in the result set. - NextLink *string -} + // Specifies the type of threshold criteria + CriterionType *CriterionType -// AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // REQUIRED; Access mode settings - AccessModeSettings *AccessModeSettings + // List of Dimensions conditions + Dimensions []*Dimension - // READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections []*PrivateEndpointConnection + // The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant + // only for rules of the kind LogAlert. + FailingPeriods *ConditionFailingPeriods - // READ-ONLY; 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. - ProvisioningState *string -} + // Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds + // (in ISO8601 format). Relevant only for dynamic threshold rules of the kind + // LogAlert. + IgnoreDataBefore *time.Time -// AzureMonitorWorkspace - Properties of an Azure Monitor workspace -type AzureMonitorWorkspace struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. - AccountID *string + // The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings + // The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics + // The minimum results count that should be found for triggering an alert. Relevant only for rules of the kind SimpleLogAlert. + MinRecurrenceCount *int64 - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState -} + // The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *ConditionOperator -// AzureMonitorWorkspaceDefaultIngestionSettings - The Data Collection Rule and Endpoint used for ingestion by default. -type AzureMonitorWorkspaceDefaultIngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. - DataCollectionEndpointResourceID *string + // Log query alert + Query *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *string -} + // The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only + // for rules of the kind LogAlert. + ResourceIDColumn *string -// AzureMonitorWorkspaceMetrics - Information about metrics for the Azure Monitor workspace -type AzureMonitorWorkspaceMetrics struct { - // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system - InternalID *string + // the criteria threshold value that activates the alert. Relevant and required only for static threshold rules of the kind + // LogAlert. + Threshold *float64 - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string + // Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *TimeAggregation } -// AzureMonitorWorkspaceResource - An Azure Monitor Workspace definition -type AzureMonitorWorkspaceResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource properties - Properties *AzureMonitorWorkspaceResourceProperties +// ConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to +// raise an alert. Relevant only for rules of the kind LogAlert. +type ConditionFailingPeriods struct { + // The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is + // 1 + MinFailingPeriodsToAlert *int64 - // Resource tags. - Tags map[string]*string + // 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. Default value is 1 + NumberOfEvaluationPeriods *int64 +} - // READ-ONLY; Resource entity tag (ETag) - Etag *string +// Context - The context info +type Context struct { + // The context id type + ContextType *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // The source of the notification request + NotificationSource *string +} - // READ-ONLY; The name of the resource +// Dimension splitting and filtering definition +type Dimension struct { + // REQUIRED; Name of the dimension Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // REQUIRED; Operator for dimension values + Operator *DimensionOperator - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // REQUIRED; List of dimension values + Values []*string } -// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for update operation -type AzureMonitorWorkspaceResourceForUpdate struct { - // Resource tags - Tags map[string]*string -} - -// AzureMonitorWorkspaceResourceListResult - A pageable list of resources -type AzureMonitorWorkspaceResourceListResult struct { - // REQUIRED; A list of resources - Value []*AzureMonitorWorkspaceResource - - // The URL to use for getting the next set of results - NextLink *string -} - -// AzureMonitorWorkspaceResourceProperties - Resource properties -type AzureMonitorWorkspaceResourceProperties struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. - AccountID *string +// EmailReceiver - An email receiver. +type EmailReceiver struct { + // REQUIRED; The email address of this receiver. + EmailAddress *string - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings + // REQUIRED; The name of the email receiver. Names must be unique across all receivers within an action group. + Name *string - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState + // READ-ONLY; The receiver status of the e-mail. + Status *ReceiverStatus } -// AzureResource - An azure resource object -type AzureResource struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string +// EnableRequest - Describes a receiver that should be resubscribed. +type EnableRequest struct { + // REQUIRED; The name of the receiver to resubscribe. + ReceiverName *string } -// AzureResourceAutoGenerated - An Azure resource object. -type AzureResourceAutoGenerated struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. - Location *string - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource Id. - ID *string - - // READ-ONLY; The name of the resource. - Name *string +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // READ-ONLY; The type of the resource. + // READ-ONLY; The additional info type. Type *string } -// BaselineMetadata - Represents a baseline metadata value. -type BaselineMetadata struct { - // REQUIRED; Name of the baseline metadata. - Name *string - - // REQUIRED; Value of the baseline metadata. - Value *string -} - -// ColumnDefinition - Definition of custom data column. -type ColumnDefinition struct { - // The name of the column. - Name *string - - // The type of the column data. - Type *KnownColumnDefinitionType +// ErrorContract - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.) +type ErrorContract struct { + // The error object. + Error *ErrorResponseAutoGenerated } -// Condition - A condition of the scheduled query rule. -type Condition struct { - // List of Dimensions conditions - Dimensions []*Dimension - - // The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant - // only for rules of the kind LogAlert. - FailingPeriods *ConditionFailingPeriods - - // The column containing the metric measure number. Relevant only for rules of the kind LogAlert. - MetricMeasureColumn *string - - // The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. - MetricName *string - - // The criteria operator. Relevant and required only for rules of the kind LogAlert. - Operator *ConditionOperator - - // Log query alert - Query *string - - // The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only - // for rules of the kind LogAlert. - ResourceIDColumn *string - - // the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. - Threshold *float64 +// ErrorResponse - Describes the format of Error response. +type ErrorResponse struct { + // Error code + Code *string - // Aggregation type. Relevant and required only for rules of the kind LogAlert. - TimeAggregation *TimeAggregation + // Error message indicating why the operation failed. + Message *string } -// ConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to -// raise an alert. Relevant only for rules of the kind LogAlert. -type ConditionFailingPeriods struct { - // The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is - // 1 - MinFailingPeriodsToAlert *int64 +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.) +type ErrorResponseAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo - // 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. Default value is 1 - NumberOfEvaluationPeriods *int64 -} + // READ-ONLY; The error code. + Code *string -// ConfigurationAccessEndpointSpec - Definition of the endpoint used for accessing configuration. -type ConfigurationAccessEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} + // READ-ONLY; The error details. + Details []*ErrorResponseAutoGenerated -// Context - The context info -type Context struct { - // The context id type - ContextType *string + // READ-ONLY; The error message. + Message *string - // The source of the notification request - NotificationSource *string + // READ-ONLY; The error target. + Target *string } -// DataCollectionEndpoint - Definition of data collection endpoint. -type DataCollectionEndpoint struct { - // The endpoint used by clients to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess +// EventHubReceiver - An Event hub receiver. +type EventHubReceiver struct { + // REQUIRED; The name of the specific Event Hub queue + EventHubName *string - // Description of the data collection endpoint. - Description *string + // REQUIRED; The Event Hub namespace + EventHubNameSpace *string - // The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string + // REQUIRED; The name of the Event hub receiver. Names must be unique across all receivers within an action group. + Name *string - // The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion + // REQUIRED; The Id for the subscription containing this event hub + SubscriptionID *string - // The endpoint used by clients to ingest metrics. - MetricsIngestion *DataCollectionEndpointMetricsIngestion + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string - // Network access control rules for the endpoints. - NetworkACLs *DataCollectionEndpointNetworkACLs + // The tenant Id for the subscription containing this event hub + TenantID *string - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. - FailoverConfiguration *DataCollectionEndpointFailoverConfiguration + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool +} - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. - Metadata *DataCollectionEndpointMetadata +// Identity for the resource. +type Identity struct { + // REQUIRED; Type of managed service identity. + Type *IdentityType - // READ-ONLY; List of Azure Monitor Private Link Scope Resources to which this data collection endpoint resource is associated. - // This property is READ-ONLY. - PrivateLinkScopedResources []*PrivateLinkScopedResource + // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource + // ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*UserIdentityProperties - // READ-ONLY; The resource provisioning state. This property is READ-ONLY. - ProvisioningState *KnownDataCollectionEndpointProvisioningState -} + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string -// DataCollectionEndpointConfigurationAccess - The endpoint used by clients to access their configuration. -type DataCollectionEndpointConfigurationAccess struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string + // READ-ONLY; The tenant ID of resource. + TenantID *string } -// DataCollectionEndpointFailoverConfiguration - Failover configuration on this endpoint. This property is READ-ONLY. -type DataCollectionEndpointFailoverConfiguration struct { - // Active location where data flow will occur. - ActiveLocation *string +// IncidentReceiver - An Incident receiver. +type IncidentReceiver struct { + // REQUIRED; The incident service connection + Connection *IncidentServiceConnection - // Locations that are configured for failover. - Locations []*LocationSpec -} - -// DataCollectionEndpointLogsIngestion - The endpoint used by clients to ingest logs. -type DataCollectionEndpointLogsIngestion struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} + // REQUIRED; The incident management service type + IncidentManagementService *IncidentManagementService -// DataCollectionEndpointMetadata - Metadata for the resource. This property is READ-ONLY. -type DataCollectionEndpointMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string + // REQUIRED; Field mappings for the incident service + Mappings map[string]*string - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string + // REQUIRED; The name of the Incident receiver. Names must be unique across all receivers within an action group. + Name *string } -// DataCollectionEndpointMetricsIngestion - The endpoint used by clients to ingest metrics. -type DataCollectionEndpointMetricsIngestion struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} +// IncidentServiceConnection - The connection info for Incident Receiver. +type IncidentServiceConnection struct { + // REQUIRED; GUID value representing the connection ID for the incident management service. + ID *string -// DataCollectionEndpointNetworkACLs - Network access control rules for the endpoints. -type DataCollectionEndpointNetworkACLs struct { - // The configuration to set whether network access from public internet to the endpoints are allowed. - PublicNetworkAccess *KnownPublicNetworkAccessOptions + // REQUIRED; The name of the connection. + Name *string } -// DataCollectionEndpointResource - Definition of ARM tracked top level resource. -type DataCollectionEndpointResource struct { - // REQUIRED; The geo-location where the resource lives. - Location *string - - // Managed service identity of the resource. - Identity *DataCollectionEndpointResourceIdentity +// ItsmReceiver - An Itsm receiver. +type ItsmReceiver struct { + // REQUIRED; Unique identification of ITSM connection among multiple defined in above workspace. + ConnectionID *string - // The kind of the resource. - Kind *KnownDataCollectionEndpointResourceKind + // REQUIRED; The name of the Itsm receiver. Names must be unique across all receivers within an action group. + Name *string - // Resource properties. - Properties *DataCollectionEndpointResourceProperties + // REQUIRED; Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + Region *string - // Resource tags. - Tags map[string]*string + // REQUIRED; JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob + // as well. + TicketConfiguration *string - // READ-ONLY; Resource entity tag (ETag). - Etag *string + // REQUIRED; OMS LA instance identifier. + WorkspaceID *string +} - // READ-ONLY; Fully qualified ID of the resource. - ID *string +// LogicAppReceiver - A logic app receiver. +type LogicAppReceiver struct { + // REQUIRED; The callback url where http request sent to. + CallbackURL *string - // READ-ONLY; The name of the resource. + // REQUIRED; The name of the logic app receiver. Names must be unique across all receivers within an action group. Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionEndpointResourceSystemData + // REQUIRED; The azure resource id of the logic app receiver. + ResourceID *string - // READ-ONLY; The type of the resource. - Type *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool } -// DataCollectionEndpointResourceIdentity - Managed service identity of the resource. -type DataCollectionEndpointResourceIdentity struct { +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Type *ManagedServiceIdentityType @@ -954,2802 +497,75 @@ type DataCollectionEndpointResourceIdentity struct { TenantID *string } -// DataCollectionEndpointResourceListResult - A pageable list of resources. -type DataCollectionEndpointResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionEndpointResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionEndpointResourceProperties - Resource properties. -type DataCollectionEndpointResourceProperties struct { - // The endpoint used by clients to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess - - // Description of the data collection endpoint. - Description *string +// NotificationRequestBody - The request body which contain contact detail metadata +type NotificationRequestBody struct { + // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, + // metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, + // logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget + AlertType *string - // The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string + // The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are + // supported. + ArmRoleReceivers []*ArmRoleReceiver - // The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion + // The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers []*AutomationRunbookReceiver - // The endpoint used by clients to ingest metrics. - MetricsIngestion *DataCollectionEndpointMetricsIngestion + // The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers []*AzureAppPushReceiver - // Network access control rules for the endpoints. - NetworkACLs *DataCollectionEndpointNetworkACLs + // The list of azure function receivers that are part of this action group. + AzureFunctionReceivers []*AzureFunctionReceiver - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. - FailoverConfiguration *DataCollectionEndpointFailoverConfiguration + // The list of email receivers that are part of this action group. + EmailReceivers []*EmailReceiver - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. - Metadata *DataCollectionEndpointMetadata + // The list of event hub receivers that are part of this action group. + EventHubReceivers []*EventHubReceiver - // READ-ONLY; List of Azure Monitor Private Link Scope Resources to which this data collection endpoint resource is associated. - // This property is READ-ONLY. - PrivateLinkScopedResources []*PrivateLinkScopedResource + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver - // READ-ONLY; The resource provisioning state. This property is READ-ONLY. - ProvisioningState *KnownDataCollectionEndpointProvisioningState -} + // The list of ITSM receivers that are part of this action group. + ItsmReceivers []*ItsmReceiver -// DataCollectionEndpointResourceSystemData - Metadata pertaining to creation and last modification of the resource. -type DataCollectionEndpointResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time + // The list of logic app receivers that are part of this action group. + LogicAppReceivers []*LogicAppReceiver - // The identity that created the resource. - CreatedBy *string + // The list of SMS receivers that are part of this action group. + SmsReceivers []*SmsReceiver - // The type of identity that created the resource. - CreatedByType *CreatedByType + // The list of voice receivers that are part of this action group. + VoiceReceivers []*VoiceReceiver - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time + // The list of webhook receivers that are part of this action group. + WebhookReceivers []*WebhookReceiver +} - // The identity that last modified the resource. - LastModifiedBy *string +// RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + // The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType + // The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration + // format. + TimeToResolve *string } -// DataCollectionRule - Definition of what monitoring data to collect and where that data should be sent. -type DataCollectionRule struct { - // The resource ID of the data collection endpoint that this rule can be used with. - DataCollectionEndpointID *string +// ScheduledQueryRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + // A list of conditions to evaluate against the specified scopes + AllOf []*Condition +} - // The specification of data flows. - DataFlows []*DataFlow +// ScheduledQueryRuleProperties - scheduled query rule Definition +type ScheduledQueryRuleProperties struct { + // Actions to invoke when the alert fires. + Actions *Actions - // 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. - DataSources *DataCollectionRuleDataSources - - // Description of the data collection rule. - Description *string - - // The specification of destinations. - Destinations *DataCollectionRuleDestinations - - // Declaration of custom streams used in this rule. - StreamDeclarations map[string]*StreamDeclaration - - // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleProvisioningState -} - -// DataCollectionRuleAssociation - Definition of association of a data collection rule with a monitored Azure resource. -type DataCollectionRuleAssociation struct { - // The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string - - // The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string - - // Description of the association. - Description *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleAssociationMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleAssociationProvisioningState -} - -// DataCollectionRuleAssociationMetadata - Metadata about the resource -type DataCollectionRuleAssociationMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// DataCollectionRuleAssociationProxyOnlyResource - Definition of generic ARM proxy resource. -type DataCollectionRuleAssociationProxyOnlyResource struct { - // Resource properties. - Properties *DataCollectionRuleAssociationProxyOnlyResourceProperties - - // READ-ONLY; Resource entity tag (ETag). - Etag *string - - // READ-ONLY; Fully qualified ID of the resource. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResult - A pageable list of resources. -type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionRuleAssociationProxyOnlyResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. -type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { - // The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string - - // The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string - - // Description of the association. - Description *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleAssociationMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleAssociationProvisioningState -} - -// DataCollectionRuleAssociationProxyOnlyResourceSystemData - Metadata pertaining to creation and last modification of the -// resource. -type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType -} - -// DataCollectionRuleDataSources - 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. -type DataCollectionRuleDataSources struct { - // Specifications of pull based data sources - DataImports *DataSourcesSpecDataImports - - // The list of Azure VM extension data source configurations. - Extensions []*ExtensionDataSource - - // The list of IIS logs source configurations. - IisLogs []*IisLogsDataSource - - // The list of Log files source configurations. - LogFiles []*LogFilesDataSource - - // The list of performance counter data source configurations. - PerformanceCounters []*PerfCounterDataSource - - // The list of platform telemetry configurations - PlatformTelemetry []*PlatformTelemetryDataSource - - // The list of Prometheus forwarder data source configurations. - PrometheusForwarder []*PrometheusForwarderDataSource - - // The list of Syslog data source configurations. - Syslog []*SyslogDataSource - - // The list of Windows Event Log data source configurations. - WindowsEventLogs []*WindowsEventLogDataSource - - // The list of Windows Firewall logs source configurations. - WindowsFirewallLogs []*WindowsFirewallLogsDataSource -} - -// DataCollectionRuleDestinations - The specification of destinations. -type DataCollectionRuleDestinations struct { - // Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics - - // List of Event Hubs destinations. - EventHubs []*EventHubDestination - - // List of Event Hubs Direct destinations. - EventHubsDirect []*EventHubDirectDestination - - // List of Log Analytics destinations. - LogAnalytics []*LogAnalyticsDestination - - // List of monitoring account destinations. - MonitoringAccounts []*MonitoringAccountDestination - - // List of storage accounts destinations. - StorageAccounts []*StorageBlobDestination - - // List of Storage Blob Direct destinations. To be used only for sending data directly to store from the agent. - StorageBlobsDirect []*StorageBlobDestination - - // List of Storage Table Direct destinations. - StorageTablesDirect []*StorageTableDestination -} - -// DataCollectionRuleMetadata - Metadata about the resource -type DataCollectionRuleMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// DataCollectionRuleResource - Definition of ARM tracked top level resource. -type DataCollectionRuleResource struct { - // REQUIRED; The geo-location where the resource lives. - Location *string - - // Managed service identity of the resource. - Identity *DataCollectionRuleResourceIdentity - - // The kind of the resource. - Kind *KnownDataCollectionRuleResourceKind - - // Resource properties. - Properties *DataCollectionRuleResourceProperties - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource entity tag (ETag). - Etag *string - - // READ-ONLY; Fully qualified ID of the resource. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleResourceSystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// DataCollectionRuleResourceIdentity - Managed service identity of the resource. -type DataCollectionRuleResourceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// DataCollectionRuleResourceListResult - A pageable list of resources. -type DataCollectionRuleResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionRuleResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionRuleResourceProperties - Resource properties. -type DataCollectionRuleResourceProperties struct { - // The resource ID of the data collection endpoint that this rule can be used with. - DataCollectionEndpointID *string - - // The specification of data flows. - DataFlows []*DataFlow - - // 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. - DataSources *DataCollectionRuleDataSources - - // Description of the data collection rule. - Description *string - - // The specification of destinations. - Destinations *DataCollectionRuleDestinations - - // Declaration of custom streams used in this rule. - StreamDeclarations map[string]*StreamDeclaration - - // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleProvisioningState -} - -// DataCollectionRuleResourceSystemData - Metadata pertaining to creation and last modification of the resource. -type DataCollectionRuleResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType -} - -// DataContainer - Information about a container with data for a given resource. -type DataContainer struct { - // REQUIRED; Log Analytics workspace information. - Workspace *WorkspaceInfo -} - -// DataFlow - Definition of which streams are sent to which destinations. -type DataFlow struct { - // The builtIn transform to transform stream data - BuiltInTransform *string - - // List of destinations for this data flow. - Destinations []*string - - // The output stream of the transform. Only required if the transform changes data to a different stream. - OutputStream *string - - // List of streams for this data flow. - Streams []*KnownDataFlowStreams - - // The KQL query to transform stream data. - TransformKql *string -} - -type DataImportSources struct { - // Definition of Event Hub configuration. - EventHub *DataImportSourcesEventHub -} - -// DataImportSourcesEventHub - Definition of Event Hub configuration. -type DataImportSourcesEventHub struct { - // Event Hub consumer group name - ConsumerGroup *string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The stream to collect from EventHub - Stream *string -} - -// DataSourcesSpec - Specification of data sources that will be collected. -type DataSourcesSpec struct { - // Specifications of pull based data sources - DataImports *DataSourcesSpecDataImports - - // The list of Azure VM extension data source configurations. - Extensions []*ExtensionDataSource - - // The list of IIS logs source configurations. - IisLogs []*IisLogsDataSource - - // The list of Log files source configurations. - LogFiles []*LogFilesDataSource - - // The list of performance counter data source configurations. - PerformanceCounters []*PerfCounterDataSource - - // The list of platform telemetry configurations - PlatformTelemetry []*PlatformTelemetryDataSource - - // The list of Prometheus forwarder data source configurations. - PrometheusForwarder []*PrometheusForwarderDataSource - - // The list of Syslog data source configurations. - Syslog []*SyslogDataSource - - // The list of Windows Event Log data source configurations. - WindowsEventLogs []*WindowsEventLogDataSource - - // The list of Windows Firewall logs source configurations. - WindowsFirewallLogs []*WindowsFirewallLogsDataSource -} - -// DataSourcesSpecDataImports - Specifications of pull based data sources -type DataSourcesSpecDataImports struct { - // Definition of Event Hub configuration. - EventHub *DataImportSourcesEventHub -} - -// DefaultErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type DefaultErrorResponse struct { - // The error object. - Error *ErrorDetail -} - -// DestinationsSpec - Specification of destinations that can be used in data flows. -type DestinationsSpec struct { - // Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics - - // List of Event Hubs destinations. - EventHubs []*EventHubDestination - - // List of Event Hubs Direct destinations. - EventHubsDirect []*EventHubDirectDestination - - // List of Log Analytics destinations. - LogAnalytics []*LogAnalyticsDestination - - // List of monitoring account destinations. - MonitoringAccounts []*MonitoringAccountDestination - - // List of storage accounts destinations. - StorageAccounts []*StorageBlobDestination - - // List of Storage Blob Direct destinations. To be used only for sending data directly to store from the agent. - StorageBlobsDirect []*StorageBlobDestination - - // List of Storage Table Direct destinations. - StorageTablesDirect []*StorageTableDestination -} - -// DestinationsSpecAzureMonitorMetrics - Azure Monitor Metrics destination. -type DestinationsSpecAzureMonitorMetrics struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// DiagnosticSettings - The diagnostic settings. -type DiagnosticSettings struct { - // The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string - - // The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string - - // 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: _. Possible values are: - // Dedicated and null (null is default.) - LogAnalyticsDestinationType *string - - // The list of logs settings. - Logs []*LogSettings - - // The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. - MarketplacePartnerID *string - - // The list of metric settings. - Metrics []*MetricSettings - - // The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string - - // The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string - - // 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 - WorkspaceID *string -} - -// DiagnosticSettingsCategory - The diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // the collection of what category groups are supported. - CategoryGroups []*string - - // The type of the diagnostic settings category. - CategoryType *CategoryType -} - -// DiagnosticSettingsCategoryResource - The diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The properties of a Diagnostic Settings Category. - Properties *DiagnosticSettingsCategory - - // READ-ONLY; The system metadata related to this resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// DiagnosticSettingsCategoryResourceCollection - Represents a collection of diagnostic setting category resources. -type DiagnosticSettingsCategoryResourceCollection struct { - // The collection of diagnostic settings category resources. - Value []*DiagnosticSettingsCategoryResource -} - -// DiagnosticSettingsResource - The diagnostic setting resource. -type DiagnosticSettingsResource struct { - // Properties of a Diagnostic Settings Resource. - Properties *DiagnosticSettings - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The system metadata related to this resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// DiagnosticSettingsResourceCollection - Represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - // The collection of diagnostic settings resources;. - Value []*DiagnosticSettingsResource -} - -// Dimension splitting and filtering definition -type Dimension struct { - // REQUIRED; Name of the dimension - Name *string - - // REQUIRED; Operator for dimension values - Operator *DimensionOperator - - // REQUIRED; List of dimension values - Values []*string -} - -// DynamicMetricCriteria - Criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // REQUIRED; The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric - // series pattern. - AlertSensitivity *DynamicThresholdSensitivity - - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; The operator used to compare the metric value against the threshold. - Operator *DynamicThresholdOperator - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds - // (in ISO8601 format) - IgnoreDataBefore *time.Time - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type DynamicMetricCriteria. -func (d *DynamicMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { - return &MultiMetricCriteria{ - AdditionalProperties: d.AdditionalProperties, - CriterionType: d.CriterionType, - Dimensions: d.Dimensions, - MetricName: d.MetricName, - MetricNamespace: d.MetricNamespace, - Name: d.Name, - SkipMetricValidation: d.SkipMetricValidation, - TimeAggregation: d.TimeAggregation, - } -} - -// DynamicThresholdFailingPeriods - The minimum number of violations required within the selected lookback time window required -// to raise an alert. -type DynamicThresholdFailingPeriods struct { - // REQUIRED; The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float32 - - // REQUIRED; 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. - NumberOfEvaluationPeriods *float32 -} - -// EmailNotification - Email notification of an autoscale event. -type EmailNotification struct { - // the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails []*string - - // a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool - - // a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool -} - -// EmailReceiver - An email receiver. -type EmailReceiver struct { - // REQUIRED; The email address of this receiver. - EmailAddress *string - - // REQUIRED; The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool - - // READ-ONLY; The receiver status of the e-mail. - Status *ReceiverStatus -} - -// EmailReceiverAutoGenerated - An email receiver. -type EmailReceiverAutoGenerated struct { - // REQUIRED; The email address of this receiver. - EmailAddress *string - - // REQUIRED; The name of the email receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool - - // READ-ONLY; The receiver status of the e-mail. - Status *ReceiverStatus -} - -// EnableRequest - Describes a receiver that should be resubscribed. -type EnableRequest struct { - // REQUIRED; The name of the receiver to resubscribe. - ReceiverName *string -} - -// Error details. -type Error struct { - // REQUIRED; Error code identifying the specific error. - Code *string - - // Error message in the caller's locale. - Message *string -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorContract - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorContract struct { - // The error object. - Error *ErrorResponse -} - -// ErrorContractAutoGenerated - Describes the format of Error response. -type ErrorContractAutoGenerated struct { - // The error details. - Error *ErrorResponseDetails -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetail - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorDetailAutoGenerated - The error detail. -type ErrorDetailAutoGenerated struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetailAutoGenerated - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorResponse - Describes the format of Error response. -type ErrorResponse struct { - // Error code - Code *string - - // Error message indicating why the operation failed. - Message *string -} - -// ErrorResponseAdditionalInfo - The resource management error additional info. -type ErrorResponseAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorResponseAutoGenerated - The error response. -type ErrorResponseAutoGenerated struct { - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error message indicating why the operation failed. - Message *string -} - -// ErrorResponseAutoGenerated2 - Common error response for all Azure Resource Manager APIs to return error details for failed -// operations. (This also follows the OData error response format.). -type ErrorResponseAutoGenerated2 struct { - // The error object. - Error *ErrorDetailAutoGenerated -} - -// ErrorResponseCommonV2 - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponseCommonV2 struct { - // The error object. - Error *ErrorDetail -} - -// ErrorResponseDetails - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorResponseDetails struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorResponseAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorResponseDetails - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// EventCategoryCollection - A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, -// Alert, Recommendation, Policy. -type EventCategoryCollection struct { - // REQUIRED; the list that includes the Azure event categories. - Value []*LocalizableString -} - -// EventData - The Azure event log entries are of type EventData -type EventData struct { - // READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization - - // READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string - - // READ-ONLY; the event category. - Category *LocalizableString - - // READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string - - // READ-ONLY; 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. - CorrelationID *string - - // READ-ONLY; the description of the event. - Description *string - - // READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string - - // READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName - // might be more appealing to end users. - EventName *LocalizableString - - // READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the - // event. It in ISO 8601 format. - EventTimestamp *time.Time - - // READ-ONLY; 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). - HTTPRequest *HTTPRequestInfo - - // READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string - - // READ-ONLY; the event level - Level *EventLevel - - // READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused - // with EventName. - OperationID *string - - // READ-ONLY; the operation name. - OperationName *LocalizableString - - // READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string - - // READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string - - // READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string - - // READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString - - // READ-ONLY; the resource type - ResourceType *LocalizableString - - // READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, - // Resolved. - Status *LocalizableString - - // READ-ONLY; 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) - SubStatus *LocalizableString - - // READ-ONLY; 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. - SubmissionTimestamp *time.Time - - // READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string - - // READ-ONLY; the Azure tenant Id - TenantID *string -} - -// EventDataCollection - Represents collection of events. -type EventDataCollection struct { - // REQUIRED; this list that includes the Azure audit logs. - Value []*EventData - - // Provides the link to retrieve the next set of events. - NextLink *string -} - -type EventHubDataSource struct { - // Event Hub consumer group name - ConsumerGroup *string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The stream to collect from EventHub - Stream *string -} - -type EventHubDestination struct { - // The resource ID of the event hub. - EventHubResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -type EventHubDirectDestination struct { - // The resource ID of the event hub. - EventHubResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// EventHubReceiver - An Event hub receiver. -type EventHubReceiver struct { - // REQUIRED; The name of the specific Event Hub queue - EventHubName *string - - // REQUIRED; The Event Hub namespace - EventHubNameSpace *string - - // REQUIRED; The name of the Event hub receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The Id for the subscription containing this event hub - SubscriptionID *string - - // The tenant Id for the subscription containing this event hub - TenantID *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// ExtensionDataSource - Definition of which data will be collected from a separate VM extension that integrates with the -// Azure Monitor Agent. Collected from either Windows and Linux machines, depending on which extension is -// defined. -type ExtensionDataSource struct { - // REQUIRED; The name of the VM extension. - ExtensionName *string - - // The extension settings. The format is specific for particular extension. - ExtensionSettings any - - // The list of data sources this extension needs data from. - InputDataSources []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // 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. - Streams []*KnownExtensionDataSourceStreams -} - -type FailoverConfigurationSpec struct { - // Active location where data flow will occur. - ActiveLocation *string - - // Locations that are configured for failover. - Locations []*LocationSpec -} - -// HTTPRequestInfo - The Http request info. -type HTTPRequestInfo struct { - // the client Ip Address - ClientIPAddress *string - - // the client request id. - ClientRequestID *string - - // the Http request method. - Method *string - - // the Uri. - URI *string -} - -// Identity for the resource. -type Identity struct { - // REQUIRED; Type of managed service identity. - Type *IdentityType - - // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource - // ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties - - // READ-ONLY; The principal ID of resource identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of resource. - TenantID *string -} - -// IisLogsDataSource - Enables IIS logs to be collected by this data collection rule. -type IisLogsDataSource struct { - // REQUIRED; IIS streams - Streams []*string - - // Absolute paths file location - LogDirectories []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// Incident - An alert incident indicates the activation status of an alert rule. -type Incident struct { - // READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *time.Time - - // READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool - - // READ-ONLY; Incident name. - Name *string - - // READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *time.Time - - // READ-ONLY; Rule name that is associated with the incident. - RuleName *string -} - -// IncidentListResult - The List incidents operation response. -type IncidentListResult struct { - // the incident collection. - Value []*Incident -} - -// IngestionSettings - Settings for data ingestion -type IngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. - DataCollectionEndpointResourceID *string - - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *string -} - -// ItsmReceiver - An Itsm receiver. -type ItsmReceiver struct { - // REQUIRED; Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string - - // REQUIRED; The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string - - // REQUIRED; JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob - // as well. - TicketConfiguration *string - - // REQUIRED; OMS LA instance identifier. - WorkspaceID *string -} - -// LocalizableString - The localizable string class. -type LocalizableString struct { - // REQUIRED; the invariant value. - Value *string - - // the locale specific value. - LocalizedValue *string -} - -type LocationSpec struct { - // Name of location. - Location *string - - // The resource provisioning state in this location. - ProvisioningStatus *KnownLocationSpecProvisioningStatus -} - -// LocationThresholdRuleCondition - A rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // REQUIRED; the number of locations that must fail to activate the alert. - FailedLocationCount *int32 - - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification - - // 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. - WindowSize *string -} - -// GetRuleCondition implements the RuleConditionClassification interface for type LocationThresholdRuleCondition. -func (l *LocationThresholdRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: l.DataSource, - ODataType: l.ODataType, - } -} - -// LogAnalyticsDestination - Log Analytics destination. -type LogAnalyticsDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the Log Analytics workspace. - WorkspaceResourceID *string - - // READ-ONLY; The Customer ID of the Log Analytics workspace. - WorkspaceID *string -} - -// LogFileSettings - Settings for different log file formats -type LogFileSettings struct { - // Text settings - Text *LogFileSettingsText -} - -// LogFileSettingsText - Text settings -type LogFileSettingsText struct { - // REQUIRED; One of the supported timestamp formats - RecordStartTimestampFormat *KnownLogFileTextSettingsRecordStartTimestampFormat -} - -// LogFileTextSettings - Settings for text log files -type LogFileTextSettings struct { - // REQUIRED; One of the supported timestamp formats - RecordStartTimestampFormat *KnownLogFileTextSettingsRecordStartTimestampFormat -} - -// LogFilesDataSource - Definition of which custom log files will be collected by this data collection rule -type LogFilesDataSource struct { - // REQUIRED; File Patterns where the log files are located - FilePatterns []*string - - // REQUIRED; The data format of the log files - Format *KnownLogFilesDataSourceFormat - - // REQUIRED; List of streams that this data source will be sent to. A stream indicates what schema will be used for this data - // source - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The log files specific settings. - Settings *LogFilesDataSourceSettings -} - -// LogFilesDataSourceSettings - The log files specific settings. -type LogFilesDataSourceSettings struct { - // Text settings - Text *LogFileSettingsText -} - -// LogProfileCollection - Represents a collection of log profiles. -type LogProfileCollection struct { - // REQUIRED; the values of the log profiles. - Value []*LogProfileResource -} - -// LogProfileProperties - The log profile properties. -type LogProfileProperties struct { - // REQUIRED; the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', - // 'Delete', and/or 'Action.' - Categories []*string - - // REQUIRED; 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. - Locations []*string - - // REQUIRED; the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy - - // 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}'. - ServiceBusRuleID *string - - // the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string -} - -// LogProfileResource - The log profile resource. -type LogProfileResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The log profile properties of the resource. - Properties *LogProfileProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// LogProfileResourcePatch - The log profile resource for patch operations. -type LogProfileResourcePatch struct { - // The log profile properties for an update operation. - Properties *LogProfileProperties - - // Resource tags - Tags map[string]*string -} - -// LogSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // REQUIRED; a value indicating whether this log is enabled. - Enabled *bool - - // 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. - Category *string - - // Name of a Diagnostic Log category group 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. - CategoryGroup *string - - // the retention policy for this log. - RetentionPolicy *RetentionPolicy -} - -// LogicAppReceiver - A logic app receiver. -type LogicAppReceiver struct { - // REQUIRED; The callback url where http request sent to. - CallbackURL *string - - // REQUIRED; The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The azure resource id of the logic app receiver. - ResourceID *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// LogsIngestionEndpointSpec - Definition of the endpoint used for ingesting logs. -type LogsIngestionEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} - -// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) -type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// ManagementEventAggregationCondition - How the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // the condition operator. - Operator *ConditionOperator - - // The threshold value that activates the alert. - Threshold *float64 - - // 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. - WindowSize *string -} - -// ManagementEventRuleCondition - A management event rule condition. -type ManagementEventRuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // 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. - Aggregation *ManagementEventAggregationCondition - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification -} - -// GetRuleCondition implements the RuleConditionClassification interface for type ManagementEventRuleCondition. -func (m *ManagementEventRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: m.DataSource, - ODataType: m.ODataType, - } -} - -// Metadata about the resource -type Metadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// MetadataValue - Represents a metric metadata value. -type MetadataValue struct { - // the name of the metadata. - Name *LocalizableString - - // the value of the metadata. - Value *string -} - -// Metric - The result data of a query. -type Metric struct { - // REQUIRED; the metric Id. - ID *string - - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString - - // REQUIRED; the time series returned when a data query is performed. - Timeseries []*TimeSeriesElement - - // REQUIRED; the resource type of the metric resource. - Type *string - - // REQUIRED; The unit of the metric. - Unit *Unit - - // Detailed description of this metric. - DisplayDescription *string - - // 'Success' or the error details on query failures for this metric. - ErrorCode *string - - // Error message encountered querying this specific metric. - ErrorMessage *string -} - -// MetricAlertAction - An alert action. -type MetricAlertAction struct { - // the id of the action group to use. - ActionGroupID *string - - // This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. - WebHookProperties map[string]*string -} - -// MetricAlertCriteria - The rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertCriteria. -func (m *MetricAlertCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { return m } - -// MetricAlertMultipleResourceMultipleMetricCriteria - Specifies the metric alert criteria for multiple resource that has -// multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // the list of multiple metric criteria for this 'all of' operation. - AllOf []MultiMetricCriteriaClassification -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m *MetricAlertMultipleResourceMultipleMetricCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: m.AdditionalProperties, - ODataType: m.ODataType, - } -} - -// MetricAlertProperties - An alert rule. -type MetricAlertProperties struct { - // REQUIRED; defines the specific alert criteria information. - Criteria MetricAlertCriteriaClassification - - // REQUIRED; the flag that indicates whether the metric alert is enabled. - Enabled *bool - - // REQUIRED; how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string - - // REQUIRED; the list of resource id's that this metric alert is scoped to. - Scopes []*string - - // REQUIRED; Alert severity {0, 1, 2, 3, 4} - Severity *int32 - - // REQUIRED; the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string - - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []*MetricAlertAction - - // the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool - - // the description of the metric alert that will be included in the alert email. - Description *string - - // 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. - TargetResourceRegion *string - - // 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. - TargetResourceType *string - - // READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// MetricAlertPropertiesPatch - An alert rule properties for patch. -type MetricAlertPropertiesPatch struct { - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []*MetricAlertAction - - // the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool - - // defines the specific alert criteria information. - Criteria MetricAlertCriteriaClassification - - // the description of the metric alert that will be included in the alert email. - Description *string - - // the flag that indicates whether the metric alert is enabled. - Enabled *bool - - // how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string - - // the list of resource id's that this metric alert is scoped to. - Scopes []*string - - // Alert severity {0, 1, 2, 3, 4} - Severity *int32 - - // the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string - - // the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string - - // the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string - - // READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// MetricAlertResource - The metric alert resource. -type MetricAlertResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The alert rule properties of the resource. - Properties *MetricAlertProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// MetricAlertResourceCollection - Represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - // the values for the alert rule resources. - Value []*MetricAlertResource -} - -// MetricAlertResourcePatch - The metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // The alert rule properties of the resource. - Properties *MetricAlertPropertiesPatch - - // Resource tags - Tags map[string]*string -} - -// MetricAlertSingleResourceMultipleMetricCriteria - Specifies the metric alert criteria for a single resource that has multiple -// metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // The list of metric criteria for this 'all of' operation. - AllOf []*MetricCriteria -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m *MetricAlertSingleResourceMultipleMetricCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: m.AdditionalProperties, - ODataType: m.ODataType, - } -} - -// MetricAlertStatus - An alert status. -type MetricAlertStatus struct { - // The alert rule arm id. - ID *string - - // The status name. - Name *string - - // The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties - - // The extended resource type name. - Type *string -} - -// MetricAlertStatusCollection - Represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - // the values for the alert rule resources. - Value []*MetricAlertStatus -} - -// MetricAlertStatusProperties - An alert status properties. -type MetricAlertStatusProperties struct { - // An object describing the type of the dimensions. - Dimensions map[string]*string - - // status value - Status *string - - // UTC time when the status was checked. - Timestamp *time.Time -} - -// MetricAvailability - Metric availability specifies the time grain (aggregation interval or frequency) and the retention -// period for that time grain. -type MetricAvailability struct { - // the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string - - // the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string -} - -// MetricBaselinesProperties - The response to a metric baselines query. -type MetricBaselinesProperties struct { - // REQUIRED; The baseline for each time series that was queried. - Baselines []*TimeSeriesBaseline - - // REQUIRED; 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. - Interval *string - - // REQUIRED; 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. - Timespan *string - - // The namespace of the metrics been queried. - Namespace *string -} - -// MetricBaselinesResponse - A list of metric baselines. -type MetricBaselinesResponse struct { - // The list of metric baselines. - Value []*SingleMetricBaseline -} - -// MetricCriteria - Criterion to filter metrics. -type MetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; the criteria operator. - Operator *Operator - - // REQUIRED; the criteria threshold value that activates the alert. - Threshold *float64 - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type MetricCriteria. -func (m *MetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { - return &MultiMetricCriteria{ - AdditionalProperties: m.AdditionalProperties, - CriterionType: m.CriterionType, - Dimensions: m.Dimensions, - MetricName: m.MetricName, - MetricNamespace: m.MetricNamespace, - Name: m.Name, - SkipMetricValidation: m.SkipMetricValidation, - TimeAggregation: m.TimeAggregation, - } -} - -// MetricDefinition - Metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // Custom category name for this metric. - Category *string - - // the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions []*LocalizableString - - // Detailed description of this metric. - DisplayDescription *string - - // the resource identifier of the metric definition. - ID *string - - // Flag to indicate whether the dimension is required. - IsDimensionRequired *bool - - // the collection of what aggregation intervals are available to be queried. - MetricAvailabilities []*MetricAvailability - - // The class of the metric. - MetricClass *MetricClass - - // the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString - - // the namespace the metric belongs to. - Namespace *string - - // the primary aggregation type value defining how to use the values for display. - PrimaryAggregationType *AggregationType - - // the resource identifier of the resource that emitted the metric. - ResourceID *string - - // the collection of what aggregation types are supported. - SupportedAggregationTypes []*AggregationType - - // the unit of the metric. - Unit *MetricUnit -} - -// MetricDefinitionCollection - Represents collection of metric definitions. -type MetricDefinitionCollection struct { - // REQUIRED; the values for the metric definitions. - Value []*MetricDefinition -} - -// MetricDimension - Specifies a metric dimension. -type MetricDimension struct { - // REQUIRED; Name of the dimension. - Name *string - - // REQUIRED; the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string - - // REQUIRED; list of dimension values. - Values []*string -} - -// MetricNamespace - Metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // Kind of namespace - Classification *NamespaceClassification - - // The ID of the metric namespace. - ID *string - - // The escaped name of the namespace. - Name *string - - // Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName - - // The type of the namespace. - Type *string -} - -// MetricNamespaceCollection - Represents collection of metric namespaces. -type MetricNamespaceCollection struct { - // REQUIRED; The values for the metric namespaces. - Value []*MetricNamespace -} - -// MetricNamespaceName - The fully qualified metric namespace name. -type MetricNamespaceName struct { - // The metric namespace name. - MetricNamespaceName *string -} - -// MetricSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // REQUIRED; a value indicating whether this category is enabled. - Enabled *bool - - // 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. - Category *string - - // the retention policy for this category. - RetentionPolicy *RetentionPolicy - - // the timegrain of the metric in ISO8601 format. - TimeGrain *string -} - -// MetricSingleDimension - The metric dimension name and value. -type MetricSingleDimension struct { - // REQUIRED; Name of the dimension. - Name *string - - // REQUIRED; Value of the dimension. - Value *string -} - -// MetricTrigger - The trigger that results in a scaling action. -type MetricTrigger struct { - // REQUIRED; the name of the metric that defines what the rule monitors. - MetricName *string - - // REQUIRED; the resource identifier of the resource the rule monitors. - MetricResourceURI *string - - // REQUIRED; the operator that is used to compare the metric data and the threshold. - Operator *ComparisonOperationType - - // REQUIRED; the metric statistic type. How the metrics from multiple instances are combined. - Statistic *MetricStatisticType - - // REQUIRED; the threshold of the metric that triggers the scale action. - Threshold *float64 - - // REQUIRED; time aggregation type. How the data that is collected should be combined over time. The default value is Average. - TimeAggregation *TimeAggregationType - - // REQUIRED; 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. - TimeGrain *string - - // REQUIRED; 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. - TimeWindow *string - - // List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions []*ScaleRuleMetricDimension - - // a value indicating whether metric should divide per instance. - DividePerInstance *bool - - // the namespace of the metric that defines what the rule monitors. - MetricNamespace *string - - // the location of the resource the rule monitors. - MetricResourceLocation *string -} - -// MetricValue - Represents a metric value. -type MetricValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. - TimeStamp *time.Time - - // the average value in the time range. - Average *float64 - - // the number of samples in the time range. Can be used to determine the number of values that contributed to the average - // value. - Count *float64 - - // the greatest value in the time range. - Maximum *float64 - - // the least value in the time range. - Minimum *float64 - - // the sum of all of the values in the time range. - Total *float64 -} - -// Metrics - Information about metrics for the workspace -type Metrics struct { - // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system - InternalID *string - - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string -} - -// MetricsIngestionEndpointSpec - Definition of the endpoint used for ingesting metrics. -type MetricsIngestionEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} - -// MonitoringAccountDestination - Monitoring account destination. -type MonitoringAccountDestination struct { - // The resource ID of the monitoring account. - AccountResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // READ-ONLY; The immutable ID of the account. - AccountID *string -} - -// MultiMetricCriteria - The types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { return m } - -// NetworkRuleSet - Definition of the network rules. -type NetworkRuleSet struct { - // The configuration to set whether network access from public internet to the endpoints are allowed. - PublicNetworkAccess *KnownPublicNetworkAccessOptions -} - -// NotificationRequestBody - The request body which contain contact detail metadata -type NotificationRequestBody struct { - // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, - // metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, - // logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget - AlertType *string - - // The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are - // supported. - ArmRoleReceivers []*ArmRoleReceiver - - // The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers []*AutomationRunbookReceiver - - // The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers []*AzureAppPushReceiver - - // The list of azure function receivers that are part of this action group. - AzureFunctionReceivers []*AzureFunctionReceiver - - // The list of email receivers that are part of this action group. - EmailReceivers []*EmailReceiver - - // The list of event hub receivers that are part of this action group. - EventHubReceivers []*EventHubReceiver - - // The list of ITSM receivers that are part of this action group. - ItsmReceivers []*ItsmReceiver - - // The list of logic app receivers that are part of this action group. - LogicAppReceivers []*LogicAppReceiver - - // The list of SMS receivers that are part of this action group. - SmsReceivers []*SmsReceiver - - // The list of voice receivers that are part of this action group. - VoiceReceivers []*VoiceReceiver - - // The list of webhook receivers that are part of this action group. - WebhookReceivers []*WebhookReceiver -} - -// Operation - Microsoft Insights API operation definition. -type Operation struct { - // Display metadata associated with the operation. - Display *OperationDisplay - - // Operation name: {provider}/{resource}/{operation} - Name *string -} - -// OperationAutoGenerated - Details of a REST API operation, returned from the Resource Provider Operations API -type OperationAutoGenerated struct { - // Localized display information for this particular operation. - Display *OperationDisplayAutoGenerated - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType - - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool - - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *string - - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin -} - -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // Operation type: Read, write, delete, etc. - Operation *string - - // Service provider: Microsoft.Insights - Provider *string - - // Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string -} - -// OperationDisplayAutoGenerated - Localized display information for this particular operation. -type OperationDisplayAutoGenerated struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string - - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string - - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string - - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string -} - -// OperationListResult - Result of the request to list Microsoft.Insights operations. It contains a list of operations and -// a URL link to get the next set of results. -type OperationListResult struct { - // URL to get the next set of operation list results if there are any. - NextLink *string - - // List of operations supported by the Microsoft.Insights provider. - Value []*Operation -} - -// OperationListResultAutoGenerated - A list of REST API operations supported by an Azure Resource Provider. It contains an -// URL link to get the next set of results. -type OperationListResultAutoGenerated struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider - Value []*OperationAutoGenerated -} - -// OperationStatus - The status of operation. -type OperationStatus struct { - // End time of the job in standard ISO8601 format. - EndTime *time.Time - - // The error detail of the operation if any. - Error *ErrorDetail - - // The operation Id. - ID *string - - // The operation name. - Name *string - - // Start time of the job in standard ISO8601 format. - StartTime *time.Time - - // The status of the operation. - Status *string -} - -// PerfCounterDataSource - Definition of which performance counters will be collected and how they will be collected by this -// data collection rule. Collected from both Windows and Linux machines where the counter is present. -type PerfCounterDataSource struct { - // 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'. - CounterSpecifiers []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The number of seconds between consecutive counter measurements (samples). - SamplingFrequencyInSeconds *int32 - - // 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. - Streams []*KnownPerfCounterDataSourceStreams -} - -// PlatformTelemetryDataSource - Definition of platform telemetry data source configuration -type PlatformTelemetryDataSource struct { - // REQUIRED; List of platform telemetry streams to collect - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// PredictiveAutoscalePolicy - The parameters for enabling predictive autoscale. -type PredictiveAutoscalePolicy struct { - // REQUIRED; the predictive autoscale mode - ScaleMode *PredictiveAutoscalePolicyScaleMode - - // the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in - // ISO 8601 format. - ScaleLookAheadTime *string -} - -// PredictiveResponse - The response to a metrics query. -type PredictiveResponse struct { - // the value of the collection. - Data []*PredictiveValue - - // 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. - Interval *string - - // The metrics being queried - MetricName *string - - // resource of the predictive metric. - TargetResourceID *string - - // 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. - Timespan *string -} - -// PredictiveValue - Represents a predictive metric value in the given bucket. -type PredictiveValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. - TimeStamp *time.Time - - // REQUIRED; Predictive value in this time bucket. - Value *float64 -} - -// PrivateEndpoint - The Private Endpoint resource. -type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint - ID *string -} - -// PrivateEndpointConnection - The Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - // Resource properties. - Properties *PrivateEndpointConnectionProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account -type PrivateEndpointConnectionListResult struct { - // Array of private endpoint connections - Value []*PrivateEndpointConnection -} - -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // REQUIRED; A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState - - // The resource of private end point. - PrivateEndpoint *PrivateEndpoint - - // READ-ONLY; The provisioning state of the private endpoint connection resource. - ProvisioningState *PrivateEndpointConnectionProvisioningState -} - -// PrivateLinkResource - A private link resource -type PrivateLinkResource struct { - // Resource properties. - Properties *PrivateLinkResourceProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// PrivateLinkResourceListResult - A list of private link resources -type PrivateLinkResourceListResult struct { - // Array of private link resources - Value []*PrivateLinkResource -} - -// PrivateLinkResourceProperties - Properties of a private link resource. -type PrivateLinkResourceProperties struct { - // The private link resource Private link DNS zone name. - RequiredZoneNames []*string - - // READ-ONLY; The private link resource group id. - GroupID *string - - // READ-ONLY; The private link resource required member names. - RequiredMembers []*string -} - -type PrivateLinkScopedResource struct { - // The resourceId of the Azure Monitor Private Link Scope Scoped Resource through which this DCE is associated with a Azure - // Monitor Private Link Scope. - ResourceID *string - - // The immutableId of the Azure Monitor Private Link Scope Resource to which the association is. - ScopeID *string -} - -// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer -// and provider. -type PrivateLinkServiceConnectionState struct { - // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string - - // The reason for approval/rejection of the connection. - Description *string - - // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - Status *PrivateEndpointServiceConnectionStatus -} - -// PrometheusForwarderDataSource - Definition of Prometheus metrics forwarding configuration. -type PrometheusForwarderDataSource struct { - // The list of label inclusion filters in the form of label "name-value" pairs. Currently only one label is supported: 'microsoftmetricsinclude_label'. - // Label values are matched case-insensitively. - LabelIncludeFilter map[string]*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // List of streams that this data source will be sent to. - Streams []*KnownPrometheusForwarderDataSourceStreams -} - -// ProxyResource - An azure resource object -type ProxyResource struct { - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ProxyResourceAutoGenerated - The resource model definition for a Azure Resource Manager proxy resource. It will not have -// tags and a location -type ProxyResourceAutoGenerated struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// Recurrence - The repeating times at which this profile begins. This element is not used if the FixedDate element is used. -type Recurrence struct { - // REQUIRED; 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. - Frequency *RecurrenceFrequency - - // REQUIRED; the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule -} - -// RecurrentSchedule - The scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // REQUIRED; the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days []*string - - // REQUIRED; 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). - Hours []*int32 - - // REQUIRED; A collection of minutes at which the profile takes effect at. - Minutes []*int32 - - // REQUIRED; 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 - TimeZone *string -} - -// Resource - The autoscale setting resource. -type Resource struct { - // REQUIRED; Resource location - Location *string - - // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this - // resource (across resource groups). A maximum of 15 tags can be provided for a - // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated - An azure resource object -type ResourceAutoGenerated struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated2 - An azure resource object -type ResourceAutoGenerated2 struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated3 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated3 struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ResourceAutoGenerated4 - An azure resource object -type ResourceAutoGenerated4 struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated5 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated5 struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ResourceForUpdate - Definition of ARM tracked top level resource properties for update operation. -type ResourceForUpdate struct { - // Managed Service Identity. - Identity *ResourceForUpdateIdentity - - // Resource tags. - Tags map[string]*string -} - -// ResourceForUpdateIdentity - Managed Service Identity. -type ResourceForUpdateIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// Response - The response to a metrics query. -type Response struct { - // REQUIRED; 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. - Timespan *string - - // REQUIRED; the value of the collection. - Value []*Metric - - // The integer value representing the relative cost of the query. - Cost *int32 - - // 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. - Interval *string - - // The namespace of the metrics being queried - Namespace *string - - // The region of the resource being queried for metrics. - Resourceregion *string -} - -// ResponseWithError - An error response from the API. -type ResponseWithError struct { - // REQUIRED; Error information. - Error *Error -} - -// RetentionPolicy - Specifies the retention policy for the log. -type RetentionPolicy struct { - // REQUIRED; the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 - - // REQUIRED; a value indicating whether the retention policy is enabled. - Enabled *bool -} - -// RuleAction - The action that is performed when the alert rule becomes active, and when an alert condition is resolved. -type RuleAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleAction. -func (r *RuleAction) GetRuleAction() *RuleAction { return r } - -// RuleCondition - The condition that results in the alert rule being activated. -type RuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification -} - -// GetRuleCondition implements the RuleConditionClassification interface for type RuleCondition. -func (r *RuleCondition) GetRuleCondition() *RuleCondition { return r } - -// RuleDataSource - The resource from which the rule collects its data. -type RuleDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the namespace of the metric. - MetricNamespace *string - - // the location of the resource. - ResourceLocation *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleDataSource. -func (r *RuleDataSource) GetRuleDataSource() *RuleDataSource { return r } - -// RuleEmailAction - Specifies the action to send email when the rule condition is evaluated. The discriminator is always -// RuleEmailAction in this case. -type RuleEmailAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string - - // the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails []*string - - // Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleEmailAction. -func (r *RuleEmailAction) GetRuleAction() *RuleAction { - return &RuleAction{ - ODataType: r.ODataType, - } -} - -// RuleManagementEventClaimsDataSource - The claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // the email address. - EmailAddress *string -} - -// RuleManagementEventDataSource - A rule management event data source. The discriminator fields is always RuleManagementEventDataSource -// in this case. -type RuleManagementEventDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the claims. - Claims *RuleManagementEventClaimsDataSource - - // the event name. - EventName *string - - // the event source. - EventSource *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the level. - Level *string - - // the namespace of the metric. - MetricNamespace *string - - // The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string - - // the resource group name. - ResourceGroupName *string - - // the location of the resource. - ResourceLocation *string - - // the resource provider name. - ResourceProviderName *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string - - // The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string - - // the substatus. - SubStatus *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) GetRuleDataSource() *RuleDataSource { - return &RuleDataSource{ - LegacyResourceID: r.LegacyResourceID, - MetricNamespace: r.MetricNamespace, - ODataType: r.ODataType, - ResourceLocation: r.ResourceLocation, - ResourceURI: r.ResourceURI, - } -} - -// RuleMetricDataSource - A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. -type RuleMetricDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the name of the metric that defines what the rule monitors. - MetricName *string - - // the namespace of the metric. - MetricNamespace *string - - // the location of the resource. - ResourceLocation *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) GetRuleDataSource() *RuleDataSource { - return &RuleDataSource{ - LegacyResourceID: r.LegacyResourceID, - MetricNamespace: r.MetricNamespace, - ODataType: r.ODataType, - ResourceLocation: r.ResourceLocation, - ResourceURI: r.ResourceURI, - } -} - -// RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. -type RuleResolveConfiguration struct { - // The flag that indicates whether or not to auto resolve a fired alert. - AutoResolved *bool - - // The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration - // format. - TimeToResolve *string -} - -// RuleWebhookAction - Specifies the action to post to service when the rule condition is evaluated. The discriminator is -// always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string - - // the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string - - // the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleWebhookAction. -func (r *RuleWebhookAction) GetRuleAction() *RuleAction { - return &RuleAction{ - ODataType: r.ODataType, - } -} - -// ScaleAction - The parameters for the scaling action. -type ScaleAction struct { - // REQUIRED; 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. - Cooldown *string - - // REQUIRED; the scale direction. Whether the scaling action increases or decreases the number of instances. - Direction *ScaleDirection - - // REQUIRED; the type of action that should occur when the scale rule fires. - Type *ScaleType - - // the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is - // 1. - Value *string -} - -// ScaleCapacity - The number of instances that can be used during this profile. -type ScaleCapacity struct { - // REQUIRED; 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. - Default *string - - // REQUIRED; 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. - Maximum *string - - // REQUIRED; the minimum number of instances for the resource. - Minimum *string -} - -// ScaleRule - A rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // REQUIRED; the trigger that results in a scaling action. - MetricTrigger *MetricTrigger - - // REQUIRED; the parameters for the scaling action. - ScaleAction *ScaleAction -} - -// ScaleRuleMetricDimension - Specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // REQUIRED; Name of the dimension. - DimensionName *string - - // REQUIRED; 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 - Operator *ScaleRuleMetricDimensionOperationType - - // REQUIRED; list of dimension values. For example: ["App1","App2"]. - Values []*string -} - -// ScheduledQueryRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule. -type ScheduledQueryRuleCriteria struct { - // A list of conditions to evaluate against the specified scopes - AllOf []*Condition -} - -// ScheduledQueryRuleProperties - scheduled query rule Definition -type ScheduledQueryRuleProperties struct { - // Actions to invoke when the alert fires. - Actions *Actions - - // The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for - // rules of the kind LogAlert. - AutoMitigate *bool + // The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for + // rules of kinds LogAlert and SimpleLogAlert. + AutoMitigate *bool // The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. // Relevant only for rules of the kind LogAlert. @@ -3773,416 +589,117 @@ type ScheduledQueryRuleProperties struct { // Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules // of the kind LogAlert. - MuteActionsDuration *string - - // If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules - // of the kind LogAlert. - OverrideQueryTimeRange *string - - // This determines if traffic is allowed over public network. By default it is enabled. - PublicNetworkAccess *PublicNetworkAccess - - // Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. - RuleResolveConfiguration *RuleResolveConfiguration - - // The list of resource id's that this scheduled query rule is scoped to. - Scopes []*string - - // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules - // of the kind LogAlert. - Severity *AlertSeverity - - // The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for - // rules of the kind LogAlert. - SkipQueryValidation *bool - - // List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource - // group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a - // different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only - // for rules of the kind LogAlert - TargetResourceTypes []*string - - // The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required - // only for rules of the kind LogAlert. - WindowSize *string - - // READ-ONLY; The api-version used when creating this alert rule - CreatedWithAPIVersion *string - - // READ-ONLY; True if alert rule is legacy Log Analytic rule - IsLegacyLogAnalyticsRule *bool - - // READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's - // storage. The default is false. - IsWorkspaceAlertsStorageConfigured *bool -} - -// ScheduledQueryRuleResource - The scheduled query rule resource. -type ScheduledQueryRuleResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // REQUIRED; The rule properties of the resource. - Properties *ScheduledQueryRuleProperties - - // The identity of the resource. - Identity *Identity - - // Indicates the type of scheduled query rule. The default is LogAlert. - Kind *Kind - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header - // per the normal etag convention. Entity tags are used for comparing two or more entities - // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match - // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; SystemData of ScheduledQueryRule. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. -type ScheduledQueryRuleResourceCollection struct { - // The values for the scheduled query rule resources. - Value []*ScheduledQueryRuleResource - - // READ-ONLY; Provides the link to retrieve the next set of elements. - NextLink *string -} - -// ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. -type ScheduledQueryRuleResourcePatch struct { - // The identity of the resource. - Identity *Identity - - // The scheduled query rule properties of the resource. - Properties *ScheduledQueryRuleProperties - - // Resource tags - Tags map[string]*string -} - -// ScopedResource - A private link scoped resource -type ScopedResource struct { - // Resource properties. - Properties *ScopedResourceProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; System data - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ScopedResourceListResult - A list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string - - // READ-ONLY; Array of results. - Value []*ScopedResource -} - -// ScopedResourceProperties - Properties of a private link scoped resource. -type ScopedResourceProperties struct { - // The resource id of the scoped Azure monitor resource. - LinkedResourceID *string - - // READ-ONLY; State of the private endpoint connection. - ProvisioningState *string -} - -// SenderAuthorization - 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' -type SenderAuthorization struct { - // the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string - - // the role of the user. For instance: Subscription Admin - Role *string - - // the scope. - Scope *string -} - -// SingleBaseline - The baseline values for a single sensitivity value. -type SingleBaseline struct { - // REQUIRED; The high thresholds of the baseline. - HighThresholds []*float64 - - // REQUIRED; The low thresholds of the baseline. - LowThresholds []*float64 - - // REQUIRED; the sensitivity of the baseline. - Sensitivity *BaselineSensitivity -} - -// SingleMetricBaseline - The baseline results of a single metric. -type SingleMetricBaseline struct { - // REQUIRED; The metric baseline Id. - ID *string - - // REQUIRED; The name of the metric for which the baselines were retrieved. - Name *string - - // REQUIRED; The metric baseline properties of the metric. - Properties *MetricBaselinesProperties - - // REQUIRED; The resource type of the metric baseline resource. - Type *string -} - -// SmsReceiver - An SMS receiver. -type SmsReceiver struct { - // REQUIRED; The country code of the SMS receiver. - CountryCode *string - - // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The phone number of the SMS receiver. - PhoneNumber *string - - // READ-ONLY; The status of the receiver. - Status *ReceiverStatus -} - -// SmsReceiverAutoGenerated - An SMS receiver. -type SmsReceiverAutoGenerated struct { - // REQUIRED; The country code of the SMS receiver. - CountryCode *string - - // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The phone number of the SMS receiver. - PhoneNumber *string - - // READ-ONLY; The status of the receiver. - Status *ReceiverStatus -} - -type StorageBlobDestination struct { - // The container name of the Storage Blob. - ContainerName *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the storage account. - StorageAccountResourceID *string -} - -type StorageTableDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the storage account. - StorageAccountResourceID *string - - // The name of the Storage Table. - TableName *string -} - -// StreamDeclaration - Declaration of a custom stream. -type StreamDeclaration struct { - // List of columns used by data in this stream. - Columns []*ColumnDefinition -} - -// SubscriptionScopeMetric - The result data of a query. -type SubscriptionScopeMetric struct { - // REQUIRED; the metric Id. - ID *string - - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString + MuteActionsDuration *string - // REQUIRED; the time series returned when a data query is performed. - Timeseries []*TimeSeriesElement + // If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules + // of the kind LogAlert. + OverrideQueryTimeRange *string - // REQUIRED; the resource type of the metric resource. - Type *string + // Defines the configuration for resolving fired alerts. Relevant only for rules of kinds LogAlert and SimpleLogAlert. + ResolveConfiguration *RuleResolveConfiguration - // REQUIRED; The unit of the metric. - Unit *MetricUnit + // The list of resource id's that this scheduled query rule is scoped to. + Scopes []*string - // Detailed description of this metric. - DisplayDescription *string + // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules + // of the kind LogAlert. + Severity *AlertSeverity - // 'Success' or the error details on query failures for this metric. - ErrorCode *string + // The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for + // rules of the kind LogAlert. + SkipQueryValidation *bool - // Error message encountered querying this specific metric. - ErrorMessage *string -} + // List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource + // group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a + // different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only + // for rules of the kind LogAlert + TargetResourceTypes []*string -// SubscriptionScopeMetricDefinition - Metric definition class specifies the metadata for a metric. -type SubscriptionScopeMetricDefinition struct { - // Custom category name for this metric. - Category *string + // The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required + // only for rules of the kind LogAlert. + WindowSize *string - // the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions []*LocalizableString + // READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string - // Detailed description of this metric. - DisplayDescription *string + // READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool - // the resource identifier of the metric definition. - ID *string + // READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's + // storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool +} - // Flag to indicate whether the dimension is required. - IsDimensionRequired *bool +// ScheduledQueryRuleResource - The scheduled query rule resource. +type ScheduledQueryRuleResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // the collection of what aggregation intervals are available to be queried. - MetricAvailabilities []*MetricAvailability + // REQUIRED; The rule properties of the resource. + Properties *ScheduledQueryRuleProperties - // The class of the metric. - MetricClass *MetricClass + // The identity of the resource. + Identity *Identity - // the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString + // Indicates the type of scheduled query rule. The default is LogAlert. + Kind *Kind - // the namespace the metric belongs to. - Namespace *string + // Resource tags. + Tags map[string]*string - // the primary aggregation type value defining how to use the values for display. - PrimaryAggregationType *MetricAggregationType + // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header + // per the normal etag convention. Entity tags are used for comparing two or more entities + // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match + // (section 14.26), and If-Range (section 14.27) header fields. + Etag *string - // the resource identifier of the resource that emitted the metric. - ResourceID *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // the collection of what aggregation types are supported. - SupportedAggregationTypes []*MetricAggregationType + // READ-ONLY; The name of the resource + Name *string - // the unit of the metric. - Unit *MetricUnit -} + // READ-ONLY; SystemData of ScheduledQueryRule. + SystemData *SystemData -// SubscriptionScopeMetricDefinitionCollection - Represents collection of metric definitions. -type SubscriptionScopeMetricDefinitionCollection struct { - // REQUIRED; The values for the metric definitions. - Value []*SubscriptionScopeMetricDefinition + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// SubscriptionScopeMetricResponse - The response to a subscription scope metrics query. -type SubscriptionScopeMetricResponse struct { - // REQUIRED; 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. - Timespan *string - - // REQUIRED; the value of the collection. - Value []*SubscriptionScopeMetric - - // The integer value representing the relative cost of the query. - Cost *int32 +// ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. +type ScheduledQueryRuleResourceCollection struct { + // The values for the scheduled query rule resources. + Value []*ScheduledQueryRuleResource - // 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. - Interval *string + // READ-ONLY; Provides the link to retrieve the next set of elements. + NextLink *string +} - // The namespace of the metrics being queried - Namespace *string +// ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. +type ScheduledQueryRuleResourcePatch struct { + // The identity of the resource. + Identity *Identity - // The region of the resource being queried for metrics. - Resourceregion *string -} + // The scheduled query rule properties of the resource. + Properties *ScheduledQueryRuleProperties -// SubscriptionScopeMetricsRequestBodyParameters - Query parameters can also be specified in the body, specifying the same -// parameter in both the body and query parameters will result in an error. -type SubscriptionScopeMetricsRequestBodyParameters struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // 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 ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - MetricNames *string - - // Metric namespace where the metrics you want reside. - MetricNamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - OrderBy *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle - // or City eq Tacoma' but don't want to see separate values for each city, - // you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. - RollUpBy *string - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *time.Time - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool + // Resource tags + Tags map[string]*string } -// SyslogDataSource - Definition of which syslog data will be collected and how it will be collected. Only collected from -// Linux machines. -type SyslogDataSource struct { - // The list of facility names. - FacilityNames []*KnownSyslogDataSourceFacilityNames - - // The log levels to collect. - LogLevels []*KnownSyslogDataSourceLogLevels +// SmsReceiver - An SMS receiver. +type SmsReceiver struct { + // REQUIRED; The country code of the SMS receiver. + CountryCode *string - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. + // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within an action group. Name *string - // 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. - Streams []*KnownSyslogDataSourceStreams + // REQUIRED; The phone number of the SMS receiver. + PhoneNumber *string + + // READ-ONLY; The status of the receiver. + Status *ReceiverStatus } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -4206,68 +723,6 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope -// instance. -type TagsResource struct { - // Resource tags - Tags map[string]*string -} - -// TenantActionGroup - A tenant action group. -type TenantActionGroup struct { - // REQUIRED; Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of - // its receivers will receive communications. - Enabled *bool - - // REQUIRED; The short name of the action group. This will be used in SMS messages. - GroupShortName *string - - // The list of AzureAppPush receivers that are part of this tenant action group. - AzureAppPushReceivers []*AzureAppPushReceiverAutoGenerated - - // The list of email receivers that are part of this tenant action group. - EmailReceivers []*EmailReceiverAutoGenerated - - // The list of SMS receivers that are part of this tenant action group. - SmsReceivers []*SmsReceiverAutoGenerated - - // The list of voice receivers that are part of this tenant action group. - VoiceReceivers []*VoiceReceiverAutoGenerated - - // The list of webhook receivers that are part of this tenant action group. - WebhookReceivers []*WebhookReceiverAutoGenerated -} - -// TenantActionGroupList - A list of tenant action groups. -type TenantActionGroupList struct { - // Provides the link to retrieve the next set of elements. - NextLink *string - - // The list of tenant action groups. - Value []*TenantActionGroupResource -} - -// TenantActionGroupResource - A tenant action group resource. -type TenantActionGroupResource struct { - // REQUIRED; Resource location - Location *string - - // The tenant action groups properties of the resource. - Properties *TenantActionGroup - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - // TestNotificationDetailsResponse - The details of the test notification results. type TestNotificationDetailsResponse struct { // REQUIRED; The overall state @@ -4286,146 +741,6 @@ type TestNotificationDetailsResponse struct { CreatedTime *string } -// ThresholdRuleCondition - A rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // REQUIRED; the operator used to compare the data and the threshold. - Operator *ConditionOperator - - // REQUIRED; the threshold value that activates the alert. - Threshold *float64 - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification - - // the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType - // of the Metric. - TimeAggregation *TimeAggregationOperator - - // 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. - WindowSize *string -} - -// GetRuleCondition implements the RuleConditionClassification interface for type ThresholdRuleCondition. -func (t *ThresholdRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: t.DataSource, - ODataType: t.ODataType, - } -} - -// TimeSeriesBaseline - The baseline values for a single time series. -type TimeSeriesBaseline struct { - // REQUIRED; The aggregation type of the metric. - Aggregation *string - - // REQUIRED; The baseline values for each sensitivity. - Data []*SingleBaseline - - // REQUIRED; The list of timestamps of the baselines. - Timestamps []*time.Time - - // The dimensions of this time series. - Dimensions []*MetricSingleDimension - - // The baseline metadata values. - MetadataValues []*BaselineMetadata -} - -// TimeSeriesElement - A time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data []*MetricValue - - // the metadata values returned if $filter was specified in the call. - Metadatavalues []*MetadataValue -} - -// TimeWindow - A specific date-time for the profile. -type TimeWindow struct { - // REQUIRED; the end time for the profile in ISO 8601 format. - End *time.Time - - // REQUIRED; the start time for the profile in ISO 8601 format. - Start *time.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 - TimeZone *string -} - -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// TrackedResourceAutoGenerated - The resource model definition for an Azure Resource Manager tracked top level resource which -// has 'tags' and a 'location' -type TrackedResourceAutoGenerated struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. @@ -4444,38 +759,6 @@ type UserIdentityProperties struct { PrincipalID *string } -// VMInsightsOnboardingStatus - VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - // Resource properties. - Properties *VMInsightsOnboardingStatusProperties - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// VMInsightsOnboardingStatusProperties - Resource properties. -type VMInsightsOnboardingStatusProperties struct { - // REQUIRED; The status of VM Insights data from the resource. When reported as present the data array will contain information - // about the data containers to which data for the specified resource is being routed. - DataStatus *DataStatus - - // REQUIRED; The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, - // is considered onboarded if at least one resource under it is onboarded. - OnboardingStatus *OnboardingStatus - - // REQUIRED; Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string - - // Containers that currently store VM Insights data for the specified resource. - Data []*DataContainer -} - // VoiceReceiver - A voice receiver. type VoiceReceiver struct { // REQUIRED; The country code of the voice receiver. @@ -4488,27 +771,6 @@ type VoiceReceiver struct { PhoneNumber *string } -// VoiceReceiverAutoGenerated - A voice receiver. -type VoiceReceiverAutoGenerated struct { - // REQUIRED; The country code of the voice receiver. - CountryCode *string - - // REQUIRED; The name of the voice receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The phone number of the voice receiver. - PhoneNumber *string -} - -// WebhookNotification - Webhook notification of an autoscale event. -type WebhookNotification struct { - // a property bag of settings. This value can be empty. - Properties map[string]*string - - // the service address to receive the notification. - ServiceURI *string -} - // WebhookReceiver - A webhook receiver. type WebhookReceiver struct { // REQUIRED; The name of the webhook receiver. Names must be unique across all receivers within an action group. @@ -4520,29 +782,8 @@ type WebhookReceiver struct { // Indicates the identifier uri for aad auth. IdentifierURI *string - // Indicates the webhook app object Id for aad auth. - ObjectID *string - - // Indicates the tenant id for aad auth. - TenantID *string - - // Indicates whether or not use AAD authentication. - UseAADAuth *bool - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// WebhookReceiverAutoGenerated - A webhook receiver. -type WebhookReceiverAutoGenerated struct { - // REQUIRED; The name of the webhook receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The URI where webhooks should be sent. - ServiceURI *string - - // Indicates the identifier uri for aad auth. - IdentifierURI *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string // Indicates the webhook app object Id for aad auth. ObjectID *string @@ -4556,72 +797,3 @@ type WebhookReceiverAutoGenerated struct { // Indicates whether to use common alert schema. UseCommonAlertSchema *bool } - -// WebtestLocationAvailabilityCriteria - Specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // REQUIRED; The Application Insights resource Id. - ComponentID *string - - // REQUIRED; The number of failed locations. - FailedLocationCount *float32 - - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // REQUIRED; The Application Insights web test Id. - WebTestID *string - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type WebtestLocationAvailabilityCriteria. -func (w *WebtestLocationAvailabilityCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: w.AdditionalProperties, - ODataType: w.ODataType, - } -} - -// WindowsEventLogDataSource - Definition of which Windows Event Log events will be collected and how they will be collected. -// Only collected from Windows machines. -type WindowsEventLogDataSource struct { - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // 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. - Streams []*KnownWindowsEventLogDataSourceStreams - - // A list of Windows Event Log queries in XPATH format. - XPathQueries []*string -} - -// WindowsFirewallLogsDataSource - Enables Firewall logs to be collected by this data collection rule. -type WindowsFirewallLogsDataSource struct { - // REQUIRED; Firewall logs streams - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// WorkspaceInfo - Information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // REQUIRED; Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string - - // REQUIRED; Location of the Log Analytics workspace. - Location *string - - // REQUIRED; Resource properties. - Properties *WorkspaceInfoProperties -} - -// WorkspaceInfoProperties - Resource properties. -type WorkspaceInfoProperties struct { - // REQUIRED; Log Analytics workspace identifier. - CustomerID *string -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index 2f4c598b5226..31cb6439bc68 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -13,79 +10,8 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "time" ) -// MarshalJSON implements the json.Marshaller interface for type AccessModeSettings. -func (a AccessModeSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "exclusions", a.Exclusions) - populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) - populate(objectMap, "queryAccessMode", a.QueryAccessMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccessModeSettings. -func (a *AccessModeSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "exclusions": - err = unpopulate(val, "Exclusions", &a.Exclusions) - delete(rawMsg, key) - case "ingestionAccessMode": - err = unpopulate(val, "IngestionAccessMode", &a.IngestionAccessMode) - delete(rawMsg, key) - case "queryAccessMode": - err = unpopulate(val, "QueryAccessMode", &a.QueryAccessMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AccessModeSettingsExclusion. -func (a AccessModeSettingsExclusion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) - populate(objectMap, "privateEndpointConnectionName", a.PrivateEndpointConnectionName) - populate(objectMap, "queryAccessMode", a.QueryAccessMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccessModeSettingsExclusion. -func (a *AccessModeSettingsExclusion) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ingestionAccessMode": - err = unpopulate(val, "IngestionAccessMode", &a.IngestionAccessMode) - delete(rawMsg, key) - case "privateEndpointConnectionName": - err = unpopulate(val, "PrivateEndpointConnectionName", &a.PrivateEndpointConnectionName) - delete(rawMsg, key) - case "queryAccessMode": - err = unpopulate(val, "QueryAccessMode", &a.QueryAccessMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionDetail. func (a ActionDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -144,6 +70,7 @@ func (a ActionGroup) MarshalJSON() ([]byte, error) { populate(objectMap, "enabled", a.Enabled) populate(objectMap, "eventHubReceivers", a.EventHubReceivers) populate(objectMap, "groupShortName", a.GroupShortName) + populate(objectMap, "incidentReceivers", a.IncidentReceivers) populate(objectMap, "itsmReceivers", a.ItsmReceivers) populate(objectMap, "logicAppReceivers", a.LogicAppReceivers) populate(objectMap, "smsReceivers", a.SmsReceivers) @@ -185,6 +112,9 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { case "groupShortName": err = unpopulate(val, "GroupShortName", &a.GroupShortName) delete(rawMsg, key) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &a.IncidentReceivers) + delete(rawMsg, key) case "itsmReceivers": err = unpopulate(val, "ItsmReceivers", &a.ItsmReceivers) delete(rawMsg, key) @@ -208,37 +138,6 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionGroupAutoGenerated. -func (a ActionGroupAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroupId", a.ActionGroupID) - populate(objectMap, "webhookProperties", a.WebhookProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupAutoGenerated. -func (a *ActionGroupAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroupId": - err = unpopulate(val, "ActionGroupID", &a.ActionGroupID) - delete(rawMsg, key) - case "webhookProperties": - err = unpopulate(val, "WebhookProperties", &a.WebhookProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionGroupList. func (a ActionGroupList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -297,36 +196,10 @@ func (a *ActionGroupPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchAutoGenerated. -func (a ActionGroupPatchAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchAutoGenerated. -func (a *ActionGroupPatchAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBody. func (a ActionGroupPatchBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", a.Identity) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -341,37 +214,9 @@ func (a *ActionGroupPatchBody) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBodyAutoGenerated. -func (a ActionGroupPatchBodyAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchBodyAutoGenerated. -func (a *ActionGroupPatchBodyAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) @@ -390,6 +235,7 @@ func (a *ActionGroupPatchBodyAutoGenerated) UnmarshalJSON(data []byte) error { func (a ActionGroupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -410,6 +256,9 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -433,37 +282,11 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionList. -func (a ActionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroups", a.ActionGroups) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionList. -func (a *ActionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroups": - err = unpopulate(val, "ActionGroups", &a.ActionGroups) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Actions. func (a Actions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionGroups", a.ActionGroups) + populate(objectMap, "actionProperties", a.ActionProperties) populate(objectMap, "customProperties", a.CustomProperties) return json.Marshal(objectMap) } @@ -480,6 +303,9 @@ func (a *Actions) UnmarshalJSON(data []byte) error { case "actionGroups": err = unpopulate(val, "ActionGroups", &a.ActionGroups) delete(rawMsg, key) + case "actionProperties": + err = unpopulate(val, "ActionProperties", &a.ActionProperties) + delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &a.CustomProperties) delete(rawMsg, key) @@ -491,20 +317,17 @@ func (a *Actions) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertResource. -func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArmRoleReceiver. +func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "roleId", a.RoleID) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityLogAlertResource. -func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmRoleReceiver. +func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -512,23 +335,14 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "roleId": + err = unpopulate(val, "RoleID", &a.RoleID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -538,22 +352,22 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRule. -func (a AlertRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutomationRunbookReceiver. +func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", a.Action) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "isEnabled", a.IsEnabled) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) + populate(objectMap, "automationAccountId", a.AutomationAccountID) + populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) + populate(objectMap, "managedIdentity", a.ManagedIdentity) populate(objectMap, "name", a.Name) - populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "runbookName", a.RunbookName) + populate(objectMap, "serviceUri", a.ServiceURI) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + populate(objectMap, "webhookResourceId", a.WebhookResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRule. -func (a *AlertRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRunbookReceiver. +func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -561,29 +375,29 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "action": - a.Action, err = unmarshalRuleActionClassification(val) + case "automationAccountId": + err = unpopulate(val, "AutomationAccountID", &a.AutomationAccountID) delete(rawMsg, key) - case "actions": - a.Actions, err = unmarshalRuleActionClassificationArray(val) + case "isGlobalRunbook": + err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) delete(rawMsg, key) - case "condition": - a.Condition, err = unmarshalRuleConditionClassification(val) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) + case "runbookName": + err = unpopulate(val, "RunbookName", &a.RunbookName) delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &a.ServiceURI) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "webhookResourceId": + err = unpopulate(val, "WebhookResourceID", &a.WebhookResourceID) delete(rawMsg, key) } if err != nil { @@ -593,15 +407,16 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition. -func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiver. +func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allOf", a.AllOf) + populate(objectMap, "emailAddress", a.EmailAddress) + populate(objectMap, "name", a.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAllOfCondition. -func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiver. +func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -609,8 +424,11 @@ func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "allOf": - err = unpopulate(val, "AllOf", &a.AllOf) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &a.EmailAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) } if err != nil { @@ -620,18 +438,20 @@ func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition. -func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. +func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "anyOf", a.AnyOf) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) + populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) + populate(objectMap, "functionName", a.FunctionName) + populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) + populate(objectMap, "managedIdentity", a.ManagedIdentity) + populate(objectMap, "name", a.Name) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAnyOfOrLeafCondition. -func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionReceiver. +func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -639,17 +459,23 @@ func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "anyOf": - err = unpopulate(val, "AnyOf", &a.AnyOf) + case "functionAppResourceId": + err = unpopulate(val, "FunctionAppResourceID", &a.FunctionAppResourceID) + delete(rawMsg, key) + case "functionName": + err = unpopulate(val, "FunctionName", &a.FunctionName) + delete(rawMsg, key) + case "httpTriggerUrl": + err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) delete(rawMsg, key) - case "containsAny": - err = unpopulate(val, "ContainsAny", &a.ContainsAny) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) delete(rawMsg, key) - case "equals": - err = unpopulate(val, "Equals", &a.Equals) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "field": - err = unpopulate(val, "Field", &a.Field) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -659,17 +485,20 @@ func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition. -func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureResource. +func (a AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleLeafCondition. -func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. +func (a *AzureResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -677,14 +506,23 @@ func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "containsAny": - err = unpopulate(val, "ContainsAny", &a.ContainsAny) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) - case "equals": - err = unpopulate(val, "Equals", &a.Equals) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) - case "field": - err = unpopulate(val, "Field", &a.Field) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -694,10425 +532,1264 @@ func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleList. -func (a AlertRuleList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) +// MarshalJSON implements the json.Marshaller interface for type Condition. +func (c Condition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertSensitivity", c.AlertSensitivity) + populate(objectMap, "criterionType", c.CriterionType) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "failingPeriods", c.FailingPeriods) + populateDateTimeRFC3339(objectMap, "ignoreDataBefore", c.IgnoreDataBefore) + populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) + populate(objectMap, "metricName", c.MetricName) + populate(objectMap, "minRecurrenceCount", c.MinRecurrenceCount) + populate(objectMap, "operator", c.Operator) + populate(objectMap, "query", c.Query) + populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) + populate(objectMap, "threshold", c.Threshold) + populate(objectMap, "timeAggregation", c.TimeAggregation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleList. -func (a *AlertRuleList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. +func (c *Condition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &c.AlertSensitivity) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "criterionType": + err = unpopulate(val, "CriterionType", &c.CriterionType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &c.Dimensions) + delete(rawMsg, key) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) + delete(rawMsg, key) + case "ignoreDataBefore": + err = unpopulateDateTimeRFC3339(val, "IgnoreDataBefore", &c.IgnoreDataBefore) + delete(rawMsg, key) + case "metricMeasureColumn": + err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &c.MetricName) + delete(rawMsg, key) + case "minRecurrenceCount": + err = unpopulate(val, "MinRecurrenceCount", &c.MinRecurrenceCount) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &c.Operator) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &c.Query) + delete(rawMsg, key) + case "resourceIdColumn": + err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &c.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchObject. -func (a AlertRulePatchObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. +func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchObject. -func (a *AlertRulePatchObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionFailingPeriods. +func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "numberOfEvaluationPeriods": + err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchProperties. -func (a AlertRulePatchProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Context. +func (c Context) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "contextType", c.ContextType) + populate(objectMap, "notificationSource", c.NotificationSource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchProperties. -func (a *AlertRulePatchProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Context. +func (c *Context) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "contextType": + err = unpopulate(val, "ContextType", &c.ContextType) + delete(rawMsg, key) + case "notificationSource": + err = unpopulate(val, "NotificationSource", &c.NotificationSource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties. -func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "scopes", a.Scopes) + populate(objectMap, "name", d.Name) + populate(objectMap, "operator", d.Operator) + populate(objectMap, "values", d.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties. -func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. +func (d *Dimension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &a.Actions) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &a.Condition) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &a.Scopes) + case "values": + err = unpopulate(val, "Values", &d.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResource. -func (a AlertRuleResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailReceiver. +func (e EmailReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "emailAddress", e.EmailAddress) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResource. -func (a *AlertRuleResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiver. +func (e *EmailReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "status": + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourceCollection. -func (a AlertRuleResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EnableRequest. +func (e EnableRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "receiverName", e.ReceiverName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceCollection. -func (a *AlertRuleResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EnableRequest. +func (e *EnableRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "receiverName": + err = unpopulate(val, "ReceiverName", &e.ReceiverName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourcePatch. -func (a AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourcePatch. -func (a *AlertRuleResourcePatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArmRoleReceiver. -func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorContract. +func (e ErrorContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - populate(objectMap, "roleId", a.RoleID) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArmRoleReceiver. -func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContract. +func (e *ErrorContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "roleId": - err = unpopulate(val, "RoleID", &a.RoleID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutomationRunbookReceiver. -func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "automationAccountId", a.AutomationAccountID) - populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) - populate(objectMap, "name", a.Name) - populate(objectMap, "runbookName", a.RunbookName) - populate(objectMap, "serviceUri", a.ServiceURI) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) - populate(objectMap, "webhookResourceId", a.WebhookResourceID) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRunbookReceiver. -func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "automationAccountId": - err = unpopulate(val, "AutomationAccountID", &a.AutomationAccountID) - delete(rawMsg, key) - case "isGlobalRunbook": - err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "runbookName": - err = unpopulate(val, "RunbookName", &a.RunbookName) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &a.ServiceURI) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) - delete(rawMsg, key) - case "webhookResourceId": - err = unpopulate(val, "WebhookResourceID", &a.WebhookResourceID) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponse. -func (a AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", a.Error) - populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponse. -func (a *AutoscaleErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &a.Error) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponseError. -func (a AutoscaleErrorResponseError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. +func (e EventHubReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", a.Code) - populate(objectMap, "details", a.Details) - populate(objectMap, "message", a.Message) - populate(objectMap, "target", a.Target) + populate(objectMap, "eventHubName", e.EventHubName) + populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) + populate(objectMap, "managedIdentity", e.ManagedIdentity) + populate(objectMap, "name", e.Name) + populate(objectMap, "subscriptionId", e.SubscriptionID) + populate(objectMap, "tenantId", e.TenantID) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponseError. -func (a *AutoscaleErrorResponseError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubReceiver. +func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &a.Code) + case "eventHubName": + err = unpopulate(val, "EventHubName", &e.EventHubName) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &a.Details) + case "eventHubNameSpace": + err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &a.Message) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &e.ManagedIdentity) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &a.Target) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleNotification. -func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "email", a.Email) - objectMap["operation"] = "Scale" - populate(objectMap, "webhooks", a.Webhooks) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleNotification. -func (a *AutoscaleNotification) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "email": - err = unpopulate(val, "Email", &a.Email) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &a.Operation) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) - case "webhooks": - err = unpopulate(val, "Webhooks", &a.Webhooks) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleProfile. -func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentReceiver. +func (i IncidentReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capacity", a.Capacity) - populate(objectMap, "fixedDate", a.FixedDate) - populate(objectMap, "name", a.Name) - populate(objectMap, "recurrence", a.Recurrence) - populate(objectMap, "rules", a.Rules) + populate(objectMap, "connection", i.Connection) + populate(objectMap, "incidentManagementService", i.IncidentManagementService) + populate(objectMap, "mappings", i.Mappings) + populate(objectMap, "name", i.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleProfile. -func (a *AutoscaleProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentReceiver. +func (i *IncidentReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "capacity": - err = unpopulate(val, "Capacity", &a.Capacity) - delete(rawMsg, key) - case "fixedDate": - err = unpopulate(val, "FixedDate", &a.FixedDate) + case "connection": + err = unpopulate(val, "Connection", &i.Connection) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "incidentManagementService": + err = unpopulate(val, "IncidentManagementService", &i.IncidentManagementService) delete(rawMsg, key) - case "recurrence": - err = unpopulate(val, "Recurrence", &a.Recurrence) + case "mappings": + err = unpopulate(val, "Mappings", &i.Mappings) delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSetting. -func (a AutoscaleSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentServiceConnection. +func (i IncidentServiceConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "name", a.Name) - populate(objectMap, "notifications", a.Notifications) - populate(objectMap, "predictiveAutoscalePolicy", a.PredictiveAutoscalePolicy) - populate(objectMap, "profiles", a.Profiles) - populate(objectMap, "targetResourceLocation", a.TargetResourceLocation) - populate(objectMap, "targetResourceUri", a.TargetResourceURI) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSetting. -func (a *AutoscaleSetting) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentServiceConnection. +func (i *IncidentServiceConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "notifications": - err = unpopulate(val, "Notifications", &a.Notifications) - delete(rawMsg, key) - case "predictiveAutoscalePolicy": - err = unpopulate(val, "PredictiveAutoscalePolicy", &a.PredictiveAutoscalePolicy) - delete(rawMsg, key) - case "profiles": - err = unpopulate(val, "Profiles", &a.Profiles) - delete(rawMsg, key) - case "targetResourceLocation": - err = unpopulate(val, "TargetResourceLocation", &a.TargetResourceLocation) - delete(rawMsg, key) - case "targetResourceUri": - err = unpopulate(val, "TargetResourceURI", &a.TargetResourceURI) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResource. -func (a AutoscaleSettingResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. +func (i ItsmReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "connectionId", i.ConnectionID) + populate(objectMap, "name", i.Name) + populate(objectMap, "region", i.Region) + populate(objectMap, "ticketConfiguration", i.TicketConfiguration) + populate(objectMap, "workspaceId", i.WorkspaceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResource. -func (a *AutoscaleSettingResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ItsmReceiver. +func (i *ItsmReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "connectionId": + err = unpopulate(val, "ConnectionID", &i.ConnectionID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "region": + err = unpopulate(val, "Region", &i.Region) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "ticketConfiguration": + err = unpopulate(val, "TicketConfiguration", &i.TicketConfiguration) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &i.WorkspaceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourceCollection. -func (a AutoscaleSettingResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. +func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "callbackUrl", l.CallbackURL) + populate(objectMap, "managedIdentity", l.ManagedIdentity) + populate(objectMap, "name", l.Name) + populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "useCommonAlertSchema", l.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourceCollection. -func (a *AutoscaleSettingResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicAppReceiver. +func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "callbackUrl": + err = unpopulate(val, "CallbackURL", &l.CallbackURL) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &l.ManagedIdentity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &l.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourcePatch. -func (a AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourcePatch. -func (a *AutoscaleSettingResourcePatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiver. -func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. +func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emailAddress", a.EmailAddress) - populate(objectMap, "name", a.Name) + populate(objectMap, "alertType", n.AlertType) + populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) + populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) + populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) + populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) + populate(objectMap, "emailReceivers", n.EmailReceivers) + populate(objectMap, "eventHubReceivers", n.EventHubReceivers) + populate(objectMap, "incidentReceivers", n.IncidentReceivers) + populate(objectMap, "itsmReceivers", n.ItsmReceivers) + populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) + populate(objectMap, "smsReceivers", n.SmsReceivers) + populate(objectMap, "voiceReceivers", n.VoiceReceivers) + populate(objectMap, "webhookReceivers", n.WebhookReceivers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiver. -func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. +func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &a.EmailAddress) + case "alertType": + err = unpopulate(val, "AlertType", &n.AlertType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "armRoleReceivers": + err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiverAutoGenerated. -func (a AzureAppPushReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", a.EmailAddress) - populate(objectMap, "name", a.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiverAutoGenerated. -func (a *AzureAppPushReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &a.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. -func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) - populate(objectMap, "functionName", a.FunctionName) - populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) - populate(objectMap, "name", a.Name) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionReceiver. -func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "functionAppResourceId": - err = unpopulate(val, "FunctionAppResourceID", &a.FunctionAppResourceID) - delete(rawMsg, key) - case "functionName": - err = unpopulate(val, "FunctionName", &a.FunctionName) - delete(rawMsg, key) - case "httpTriggerUrl": - err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorMetricsDestination. -func (a AzureMonitorMetricsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorMetricsDestination. -func (a *AzureMonitorMetricsDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScope. -func (a AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScope. -func (a *AzureMonitorPrivateLinkScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeListResult. -func (a AzureMonitorPrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeListResult. -func (a *AzureMonitorPrivateLinkScopeListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeProperties. -func (a AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accessModeSettings", a.AccessModeSettings) - populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeProperties. -func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accessModeSettings": - err = unpopulate(val, "AccessModeSettings", &a.AccessModeSettings) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspace. -func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) - populate(objectMap, "metrics", a.Metrics) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspace. -func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "defaultIngestionSettings": - err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &a.Metrics) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a AzureMonitorWorkspaceDefaultIngestionSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", a.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", a.DataCollectionRuleResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a *AzureMonitorWorkspaceDefaultIngestionSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &a.DataCollectionEndpointResourceID) - delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &a.DataCollectionRuleResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceMetrics. -func (a AzureMonitorWorkspaceMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "internalId", a.InternalID) - populate(objectMap, "prometheusQueryEndpoint", a.PrometheusQueryEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceMetrics. -func (a *AzureMonitorWorkspaceMetrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "internalId": - err = unpopulate(val, "InternalID", &a.InternalID) - delete(rawMsg, key) - case "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &a.PrometheusQueryEndpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResource. -func (a AzureMonitorWorkspaceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResource. -func (a *AzureMonitorWorkspaceResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceForUpdate. -func (a AzureMonitorWorkspaceResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceForUpdate. -func (a *AzureMonitorWorkspaceResourceForUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceListResult. -func (a AzureMonitorWorkspaceResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceListResult. -func (a *AzureMonitorWorkspaceResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceProperties. -func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) - populate(objectMap, "metrics", a.Metrics) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceProperties. -func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "defaultIngestionSettings": - err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &a.Metrics) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. -func (a *AzureResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceAutoGenerated. -func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceAutoGenerated. -func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. -func (b BaselineMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", b.Name) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineMetadata. -func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. -func (c ColumnDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ColumnDefinition. -func (c *ColumnDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", c.Dimensions) - populate(objectMap, "failingPeriods", c.FailingPeriods) - populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) - populate(objectMap, "metricName", c.MetricName) - populate(objectMap, "operator", c.Operator) - populate(objectMap, "query", c.Query) - populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) - populate(objectMap, "threshold", c.Threshold) - populate(objectMap, "timeAggregation", c.TimeAggregation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. -func (c *Condition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &c.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) - delete(rawMsg, key) - case "metricMeasureColumn": - err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &c.MetricName) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &c.Operator) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) - delete(rawMsg, key) - case "resourceIdColumn": - err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &c.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. -func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionFailingPeriods. -func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minFailingPeriodsToAlert": - err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) - delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConfigurationAccessEndpointSpec. -func (c ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", c.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationAccessEndpointSpec. -func (c *ConfigurationAccessEndpointSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &c.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Context. -func (c Context) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "contextType", c.ContextType) - populate(objectMap, "notificationSource", c.NotificationSource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Context. -func (c *Context) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contextType": - err = unpopulate(val, "ContextType", &c.ContextType) - delete(rawMsg, key) - case "notificationSource": - err = unpopulate(val, "NotificationSource", &c.NotificationSource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpoint. -func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configurationAccess", d.ConfigurationAccess) - populate(objectMap, "description", d.Description) - populate(objectMap, "failoverConfiguration", d.FailoverConfiguration) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "logsIngestion", d.LogsIngestion) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "metricsIngestion", d.MetricsIngestion) - populate(objectMap, "networkAcls", d.NetworkACLs) - populate(objectMap, "privateLinkScopedResources", d.PrivateLinkScopedResources) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpoint. -func (d *DataCollectionEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configurationAccess": - err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "failoverConfiguration": - err = unpopulate(val, "FailoverConfiguration", &d.FailoverConfiguration) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "logsIngestion": - err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "metricsIngestion": - err = unpopulate(val, "MetricsIngestion", &d.MetricsIngestion) - delete(rawMsg, key) - case "networkAcls": - err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) - delete(rawMsg, key) - case "privateLinkScopedResources": - err = unpopulate(val, "PrivateLinkScopedResources", &d.PrivateLinkScopedResources) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d DataCollectionEndpointFailoverConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activeLocation", d.ActiveLocation) - populate(objectMap, "locations", d.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d *DataCollectionEndpointFailoverConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activeLocation": - err = unpopulate(val, "ActiveLocation", &d.ActiveLocation) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &d.Locations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. -func (d DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointLogsIngestion. -func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetadata. -func (d DataCollectionEndpointMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointMetadata. -func (d *DataCollectionEndpointMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d DataCollectionEndpointMetricsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d *DataCollectionEndpointMetricsIngestion) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. -func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointNetworkACLs. -func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. -func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResource. -func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceIdentity. -func (d DataCollectionEndpointResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", d.PrincipalID) - populate(objectMap, "tenantId", d.TenantID) - populate(objectMap, "type", d.Type) - populate(objectMap, "userAssignedIdentities", d.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceIdentity. -func (d *DataCollectionEndpointResourceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &d.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &d.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. -func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceListResult. -func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceProperties. -func (d DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configurationAccess", d.ConfigurationAccess) - populate(objectMap, "description", d.Description) - populate(objectMap, "failoverConfiguration", d.FailoverConfiguration) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "logsIngestion", d.LogsIngestion) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "metricsIngestion", d.MetricsIngestion) - populate(objectMap, "networkAcls", d.NetworkACLs) - populate(objectMap, "privateLinkScopedResources", d.PrivateLinkScopedResources) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceProperties. -func (d *DataCollectionEndpointResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configurationAccess": - err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "failoverConfiguration": - err = unpopulate(val, "FailoverConfiguration", &d.FailoverConfiguration) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "logsIngestion": - err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "metricsIngestion": - err = unpopulate(val, "MetricsIngestion", &d.MetricsIngestion) - delete(rawMsg, key) - case "networkAcls": - err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) - delete(rawMsg, key) - case "privateLinkScopedResources": - err = unpopulate(val, "PrivateLinkScopedResources", &d.PrivateLinkScopedResources) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSystemData. -func (d DataCollectionEndpointResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceSystemData. -func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. -func (d DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRule. -func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataFlows": - err = unpopulate(val, "DataFlows", &d.DataFlows) - delete(rawMsg, key) - case "dataSources": - err = unpopulate(val, "DataSources", &d.DataSources) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "streamDeclarations": - err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. -func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) - populate(objectMap, "description", d.Description) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociation. -func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataCollectionRuleId": - err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. -func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationMetadata. -func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. -func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. -func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) - populate(objectMap, "description", d.Description) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataCollectionRuleId": - err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. -func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataImports", d.DataImports) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "platformTelemetry", d.PlatformTelemetry) - populate(objectMap, "prometheusForwarder", d.PrometheusForwarder) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - populate(objectMap, "windowsFirewallLogs", d.WindowsFirewallLogs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDataSources. -func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataImports": - err = unpopulate(val, "DataImports", &d.DataImports) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &d.Extensions) - delete(rawMsg, key) - case "iisLogs": - err = unpopulate(val, "IisLogs", &d.IisLogs) - delete(rawMsg, key) - case "logFiles": - err = unpopulate(val, "LogFiles", &d.LogFiles) - delete(rawMsg, key) - case "performanceCounters": - err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) - delete(rawMsg, key) - case "platformTelemetry": - err = unpopulate(val, "PlatformTelemetry", &d.PlatformTelemetry) - delete(rawMsg, key) - case "prometheusForwarder": - err = unpopulate(val, "PrometheusForwarder", &d.PrometheusForwarder) - delete(rawMsg, key) - case "syslog": - err = unpopulate(val, "Syslog", &d.Syslog) - delete(rawMsg, key) - case "windowsEventLogs": - err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) - delete(rawMsg, key) - case "windowsFirewallLogs": - err = unpopulate(val, "WindowsFirewallLogs", &d.WindowsFirewallLogs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. -func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "eventHubs", d.EventHubs) - populate(objectMap, "eventHubsDirect", d.EventHubsDirect) - populate(objectMap, "logAnalytics", d.LogAnalytics) - populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) - populate(objectMap, "storageAccounts", d.StorageAccounts) - populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) - populate(objectMap, "storageTablesDirect", d.StorageTablesDirect) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDestinations. -func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureMonitorMetrics": - err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) - delete(rawMsg, key) - case "eventHubs": - err = unpopulate(val, "EventHubs", &d.EventHubs) - delete(rawMsg, key) - case "eventHubsDirect": - err = unpopulate(val, "EventHubsDirect", &d.EventHubsDirect) - delete(rawMsg, key) - case "logAnalytics": - err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) - delete(rawMsg, key) - case "monitoringAccounts": - err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) - delete(rawMsg, key) - case "storageAccounts": - err = unpopulate(val, "StorageAccounts", &d.StorageAccounts) - delete(rawMsg, key) - case "storageBlobsDirect": - err = unpopulate(val, "StorageBlobsDirect", &d.StorageBlobsDirect) - delete(rawMsg, key) - case "storageTablesDirect": - err = unpopulate(val, "StorageTablesDirect", &d.StorageTablesDirect) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. -func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. -func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. -func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResource. -func (d *DataCollectionRuleResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceIdentity. -func (d DataCollectionRuleResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", d.PrincipalID) - populate(objectMap, "tenantId", d.TenantID) - populate(objectMap, "type", d.Type) - populate(objectMap, "userAssignedIdentities", d.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceIdentity. -func (d *DataCollectionRuleResourceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &d.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &d.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceListResult. -func (d DataCollectionRuleResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceListResult. -func (d *DataCollectionRuleResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. -func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceProperties. -func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataFlows": - err = unpopulate(val, "DataFlows", &d.DataFlows) - delete(rawMsg, key) - case "dataSources": - err = unpopulate(val, "DataSources", &d.DataSources) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "streamDeclarations": - err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. -func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceSystemData. -func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataContainer. -func (d DataContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "workspace", d.Workspace) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataContainer. -func (d *DataContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "workspace": - err = unpopulate(val, "Workspace", &d.Workspace) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataFlow. -func (d DataFlow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "builtInTransform", d.BuiltInTransform) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "outputStream", d.OutputStream) - populate(objectMap, "streams", d.Streams) - populate(objectMap, "transformKql", d.TransformKql) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataFlow. -func (d *DataFlow) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "builtInTransform": - err = unpopulate(val, "BuiltInTransform", &d.BuiltInTransform) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "outputStream": - err = unpopulate(val, "OutputStream", &d.OutputStream) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &d.Streams) - delete(rawMsg, key) - case "transformKql": - err = unpopulate(val, "TransformKql", &d.TransformKql) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataImportSources. -func (d DataImportSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHub", d.EventHub) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataImportSources. -func (d *DataImportSources) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHub": - err = unpopulate(val, "EventHub", &d.EventHub) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataImportSourcesEventHub. -func (d DataImportSourcesEventHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "consumerGroup", d.ConsumerGroup) - populate(objectMap, "name", d.Name) - populate(objectMap, "stream", d.Stream) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataImportSourcesEventHub. -func (d *DataImportSourcesEventHub) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "consumerGroup": - err = unpopulate(val, "ConsumerGroup", &d.ConsumerGroup) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "stream": - err = unpopulate(val, "Stream", &d.Stream) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpec. -func (d DataSourcesSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataImports", d.DataImports) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "platformTelemetry", d.PlatformTelemetry) - populate(objectMap, "prometheusForwarder", d.PrometheusForwarder) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - populate(objectMap, "windowsFirewallLogs", d.WindowsFirewallLogs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataSourcesSpec. -func (d *DataSourcesSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataImports": - err = unpopulate(val, "DataImports", &d.DataImports) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &d.Extensions) - delete(rawMsg, key) - case "iisLogs": - err = unpopulate(val, "IisLogs", &d.IisLogs) - delete(rawMsg, key) - case "logFiles": - err = unpopulate(val, "LogFiles", &d.LogFiles) - delete(rawMsg, key) - case "performanceCounters": - err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) - delete(rawMsg, key) - case "platformTelemetry": - err = unpopulate(val, "PlatformTelemetry", &d.PlatformTelemetry) - delete(rawMsg, key) - case "prometheusForwarder": - err = unpopulate(val, "PrometheusForwarder", &d.PrometheusForwarder) - delete(rawMsg, key) - case "syslog": - err = unpopulate(val, "Syslog", &d.Syslog) - delete(rawMsg, key) - case "windowsEventLogs": - err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) - delete(rawMsg, key) - case "windowsFirewallLogs": - err = unpopulate(val, "WindowsFirewallLogs", &d.WindowsFirewallLogs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpecDataImports. -func (d DataSourcesSpecDataImports) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHub", d.EventHub) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataSourcesSpecDataImports. -func (d *DataSourcesSpecDataImports) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHub": - err = unpopulate(val, "EventHub", &d.EventHub) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponse. -func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", d.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponse. -func (d *DefaultErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &d.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. -func (d DestinationsSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "eventHubs", d.EventHubs) - populate(objectMap, "eventHubsDirect", d.EventHubsDirect) - populate(objectMap, "logAnalytics", d.LogAnalytics) - populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) - populate(objectMap, "storageAccounts", d.StorageAccounts) - populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) - populate(objectMap, "storageTablesDirect", d.StorageTablesDirect) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpec. -func (d *DestinationsSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureMonitorMetrics": - err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) - delete(rawMsg, key) - case "eventHubs": - err = unpopulate(val, "EventHubs", &d.EventHubs) - delete(rawMsg, key) - case "eventHubsDirect": - err = unpopulate(val, "EventHubsDirect", &d.EventHubsDirect) - delete(rawMsg, key) - case "logAnalytics": - err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) - delete(rawMsg, key) - case "monitoringAccounts": - err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) - delete(rawMsg, key) - case "storageAccounts": - err = unpopulate(val, "StorageAccounts", &d.StorageAccounts) - delete(rawMsg, key) - case "storageBlobsDirect": - err = unpopulate(val, "StorageBlobsDirect", &d.StorageBlobsDirect) - delete(rawMsg, key) - case "storageTablesDirect": - err = unpopulate(val, "StorageTablesDirect", &d.StorageTablesDirect) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DestinationsSpecAzureMonitorMetrics. -func (d DestinationsSpecAzureMonitorMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpecAzureMonitorMetrics. -func (d *DestinationsSpecAzureMonitorMetrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettings. -func (d DiagnosticSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubAuthorizationRuleId", d.EventHubAuthorizationRuleID) - populate(objectMap, "eventHubName", d.EventHubName) - populate(objectMap, "logAnalyticsDestinationType", d.LogAnalyticsDestinationType) - populate(objectMap, "logs", d.Logs) - populate(objectMap, "marketplacePartnerId", d.MarketplacePartnerID) - populate(objectMap, "metrics", d.Metrics) - populate(objectMap, "serviceBusRuleId", d.ServiceBusRuleID) - populate(objectMap, "storageAccountId", d.StorageAccountID) - populate(objectMap, "workspaceId", d.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettings. -func (d *DiagnosticSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubAuthorizationRuleId": - err = unpopulate(val, "EventHubAuthorizationRuleID", &d.EventHubAuthorizationRuleID) - delete(rawMsg, key) - case "eventHubName": - err = unpopulate(val, "EventHubName", &d.EventHubName) - delete(rawMsg, key) - case "logAnalyticsDestinationType": - err = unpopulate(val, "LogAnalyticsDestinationType", &d.LogAnalyticsDestinationType) - delete(rawMsg, key) - case "logs": - err = unpopulate(val, "Logs", &d.Logs) - delete(rawMsg, key) - case "marketplacePartnerId": - err = unpopulate(val, "MarketplacePartnerID", &d.MarketplacePartnerID) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &d.Metrics) - delete(rawMsg, key) - case "serviceBusRuleId": - err = unpopulate(val, "ServiceBusRuleID", &d.ServiceBusRuleID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &d.StorageAccountID) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &d.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategory. -func (d DiagnosticSettingsCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "categoryGroups", d.CategoryGroups) - populate(objectMap, "categoryType", d.CategoryType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategory. -func (d *DiagnosticSettingsCategory) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "categoryGroups": - err = unpopulate(val, "CategoryGroups", &d.CategoryGroups) - delete(rawMsg, key) - case "categoryType": - err = unpopulate(val, "CategoryType", &d.CategoryType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResource. -func (d DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResource. -func (d *DiagnosticSettingsCategoryResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResourceCollection. -func (d DiagnosticSettingsCategoryResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResourceCollection. -func (d *DiagnosticSettingsCategoryResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResource. -func (d DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResource. -func (d *DiagnosticSettingsResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResourceCollection. -func (d DiagnosticSettingsResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResourceCollection. -func (d *DiagnosticSettingsResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Dimension. -func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "values", d.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. -func (d *Dimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &d.Operator) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &d.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. -func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertSensitivity", d.AlertSensitivity) - objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion - populate(objectMap, "dimensions", d.Dimensions) - populate(objectMap, "failingPeriods", d.FailingPeriods) - populateDateTimeRFC3339(objectMap, "ignoreDataBefore", d.IgnoreDataBefore) - populate(objectMap, "metricName", d.MetricName) - populate(objectMap, "metricNamespace", d.MetricNamespace) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "skipMetricValidation", d.SkipMetricValidation) - populate(objectMap, "timeAggregation", d.TimeAggregation) - if d.AdditionalProperties != nil { - for key, val := range d.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicMetricCriteria. -func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertSensitivity": - err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) - delete(rawMsg, key) - case "criterionType": - err = unpopulate(val, "CriterionType", &d.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &d.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &d.FailingPeriods) - delete(rawMsg, key) - case "ignoreDataBefore": - err = unpopulateDateTimeRFC3339(val, "IgnoreDataBefore", &d.IgnoreDataBefore) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &d.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &d.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &d.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &d.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &d.TimeAggregation) - delete(rawMsg, key) - default: - if d.AdditionalProperties == nil { - d.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - d.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DynamicThresholdFailingPeriods. -func (d DynamicThresholdFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minFailingPeriodsToAlert", d.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", d.NumberOfEvaluationPeriods) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicThresholdFailingPeriods. -func (d *DynamicThresholdFailingPeriods) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minFailingPeriodsToAlert": - err = unpopulate(val, "MinFailingPeriodsToAlert", &d.MinFailingPeriodsToAlert) - delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &d.NumberOfEvaluationPeriods) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailNotification. -func (e EmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customEmails", e.CustomEmails) - populate(objectMap, "sendToSubscriptionAdministrator", e.SendToSubscriptionAdministrator) - populate(objectMap, "sendToSubscriptionCoAdministrators", e.SendToSubscriptionCoAdministrators) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailNotification. -func (e *EmailNotification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customEmails": - err = unpopulate(val, "CustomEmails", &e.CustomEmails) - delete(rawMsg, key) - case "sendToSubscriptionAdministrator": - err = unpopulate(val, "SendToSubscriptionAdministrator", &e.SendToSubscriptionAdministrator) - delete(rawMsg, key) - case "sendToSubscriptionCoAdministrators": - err = unpopulate(val, "SendToSubscriptionCoAdministrators", &e.SendToSubscriptionCoAdministrators) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailReceiver. -func (e EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", e.EmailAddress) - populate(objectMap, "name", e.Name) - populate(objectMap, "status", e.Status) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiver. -func (e *EmailReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &e.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailReceiverAutoGenerated. -func (e EmailReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", e.EmailAddress) - populate(objectMap, "name", e.Name) - populate(objectMap, "status", e.Status) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiverAutoGenerated. -func (e *EmailReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &e.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EnableRequest. -func (e EnableRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "receiverName", e.ReceiverName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnableRequest. -func (e *EnableRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "receiverName": - err = unpopulate(val, "ReceiverName", &e.ReceiverName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Error. -func (e *Error) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorContract. -func (e ErrorContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContract. -func (e *ErrorContract) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorContractAutoGenerated. -func (e ErrorContractAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContractAutoGenerated. -func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. -func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAdditionalInfo. -func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. -func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. -func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. -func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. -func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. -func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. -func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. -func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseDetails. -func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventCategoryCollection. -func (e EventCategoryCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventCategoryCollection. -func (e *EventCategoryCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventData. -func (e EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authorization", e.Authorization) - populate(objectMap, "caller", e.Caller) - populate(objectMap, "category", e.Category) - populate(objectMap, "claims", e.Claims) - populate(objectMap, "correlationId", e.CorrelationID) - populate(objectMap, "description", e.Description) - populate(objectMap, "eventDataId", e.EventDataID) - populate(objectMap, "eventName", e.EventName) - populateDateTimeRFC3339(objectMap, "eventTimestamp", e.EventTimestamp) - populate(objectMap, "httpRequest", e.HTTPRequest) - populate(objectMap, "id", e.ID) - populate(objectMap, "level", e.Level) - populate(objectMap, "operationId", e.OperationID) - populate(objectMap, "operationName", e.OperationName) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "resourceGroupName", e.ResourceGroupName) - populate(objectMap, "resourceId", e.ResourceID) - populate(objectMap, "resourceProviderName", e.ResourceProviderName) - populate(objectMap, "resourceType", e.ResourceType) - populate(objectMap, "status", e.Status) - populate(objectMap, "subStatus", e.SubStatus) - populateDateTimeRFC3339(objectMap, "submissionTimestamp", e.SubmissionTimestamp) - populate(objectMap, "subscriptionId", e.SubscriptionID) - populate(objectMap, "tenantId", e.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventData. -func (e *EventData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authorization": - err = unpopulate(val, "Authorization", &e.Authorization) - delete(rawMsg, key) - case "caller": - err = unpopulate(val, "Caller", &e.Caller) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &e.Category) - delete(rawMsg, key) - case "claims": - err = unpopulate(val, "Claims", &e.Claims) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &e.CorrelationID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "eventDataId": - err = unpopulate(val, "EventDataID", &e.EventDataID) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &e.EventName) - delete(rawMsg, key) - case "eventTimestamp": - err = unpopulateDateTimeRFC3339(val, "EventTimestamp", &e.EventTimestamp) - delete(rawMsg, key) - case "httpRequest": - err = unpopulate(val, "HTTPRequest", &e.HTTPRequest) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &e.Level) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &e.OperationID) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &e.OperationName) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &e.ResourceGroupName) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &e.ResourceProviderName) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &e.ResourceType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &e.SubStatus) - delete(rawMsg, key) - case "submissionTimestamp": - err = unpopulateDateTimeRFC3339(val, "SubmissionTimestamp", &e.SubmissionTimestamp) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventDataCollection. -func (e EventDataCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventDataCollection. -func (e *EventDataCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDataSource. -func (e EventHubDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "consumerGroup", e.ConsumerGroup) - populate(objectMap, "name", e.Name) - populate(objectMap, "stream", e.Stream) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDataSource. -func (e *EventHubDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "consumerGroup": - err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "stream": - err = unpopulate(val, "Stream", &e.Stream) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDestination. -func (e EventHubDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubResourceId", e.EventHubResourceID) - populate(objectMap, "name", e.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDestination. -func (e *EventHubDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDirectDestination. -func (e EventHubDirectDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubResourceId", e.EventHubResourceID) - populate(objectMap, "name", e.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDirectDestination. -func (e *EventHubDirectDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. -func (e EventHubReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubName", e.EventHubName) - populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) - populate(objectMap, "name", e.Name) - populate(objectMap, "subscriptionId", e.SubscriptionID) - populate(objectMap, "tenantId", e.TenantID) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubReceiver. -func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubName": - err = unpopulate(val, "EventHubName", &e.EventHubName) - delete(rawMsg, key) - case "eventHubNameSpace": - err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionDataSource. -func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extensionName", e.ExtensionName) - populateAny(objectMap, "extensionSettings", e.ExtensionSettings) - populate(objectMap, "inputDataSources", e.InputDataSources) - populate(objectMap, "name", e.Name) - populate(objectMap, "streams", e.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionDataSource. -func (e *ExtensionDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extensionName": - err = unpopulate(val, "ExtensionName", &e.ExtensionName) - delete(rawMsg, key) - case "extensionSettings": - err = unpopulate(val, "ExtensionSettings", &e.ExtensionSettings) - delete(rawMsg, key) - case "inputDataSources": - err = unpopulate(val, "InputDataSources", &e.InputDataSources) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &e.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FailoverConfigurationSpec. -func (f FailoverConfigurationSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activeLocation", f.ActiveLocation) - populate(objectMap, "locations", f.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverConfigurationSpec. -func (f *FailoverConfigurationSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activeLocation": - err = unpopulate(val, "ActiveLocation", &f.ActiveLocation) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &f.Locations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPRequestInfo. -func (h HTTPRequestInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientIpAddress", h.ClientIPAddress) - populate(objectMap, "clientRequestId", h.ClientRequestID) - populate(objectMap, "method", h.Method) - populate(objectMap, "uri", h.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRequestInfo. -func (h *HTTPRequestInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientIpAddress": - err = unpopulate(val, "ClientIPAddress", &h.ClientIPAddress) - delete(rawMsg, key) - case "clientRequestId": - err = unpopulate(val, "ClientRequestID", &h.ClientRequestID) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &h.Method) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &h.URI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. -func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logDirectories", i.LogDirectories) - populate(objectMap, "name", i.Name) - populate(objectMap, "streams", i.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IisLogsDataSource. -func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "logDirectories": - err = unpopulate(val, "LogDirectories", &i.LogDirectories) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &i.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "activatedTime", i.ActivatedTime) - populate(objectMap, "isActive", i.IsActive) - populate(objectMap, "name", i.Name) - populateDateTimeRFC3339(objectMap, "resolvedTime", i.ResolvedTime) - populate(objectMap, "ruleName", i.RuleName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Incident. -func (i *Incident) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activatedTime": - err = unpopulateDateTimeRFC3339(val, "ActivatedTime", &i.ActivatedTime) - delete(rawMsg, key) - case "isActive": - err = unpopulate(val, "IsActive", &i.IsActive) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "resolvedTime": - err = unpopulateDateTimeRFC3339(val, "ResolvedTime", &i.ResolvedTime) - delete(rawMsg, key) - case "ruleName": - err = unpopulate(val, "RuleName", &i.RuleName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentListResult. -func (i IncidentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentListResult. -func (i *IncidentListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. -func (i IngestionSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. -func (i *IngestionSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) - delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. -func (i ItsmReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectionId", i.ConnectionID) - populate(objectMap, "name", i.Name) - populate(objectMap, "region", i.Region) - populate(objectMap, "ticketConfiguration", i.TicketConfiguration) - populate(objectMap, "workspaceId", i.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ItsmReceiver. -func (i *ItsmReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "connectionId": - err = unpopulate(val, "ConnectionID", &i.ConnectionID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &i.Region) - delete(rawMsg, key) - case "ticketConfiguration": - err = unpopulate(val, "TicketConfiguration", &i.TicketConfiguration) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &i.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocalizableString. -func (l LocalizableString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "localizedValue", l.LocalizedValue) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableString. -func (l *LocalizableString) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocationSpec. -func (l LocationSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "location", l.Location) - populate(objectMap, "provisioningStatus", l.ProvisioningStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationSpec. -func (l *LocationSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "location": - err = unpopulate(val, "Location", &l.Location) - delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocationThresholdRuleCondition. -func (l LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", l.DataSource) - populate(objectMap, "failedLocationCount", l.FailedLocationCount) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - populate(objectMap, "windowSize", l.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationThresholdRuleCondition. -func (l *LocationThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - l.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &l.FailedLocationCount) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &l.ODataType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &l.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsDestination. -func (l LogAnalyticsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", l.Name) - populate(objectMap, "workspaceId", l.WorkspaceID) - populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsDestination. -func (l *LogAnalyticsDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) - delete(rawMsg, key) - case "workspaceResourceId": - err = unpopulate(val, "WorkspaceResourceID", &l.WorkspaceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileSettings. -func (l LogFileSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "text", l.Text) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettings. -func (l *LogFileSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "text": - err = unpopulate(val, "Text", &l.Text) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileSettingsText. -func (l LogFileSettingsText) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettingsText. -func (l *LogFileSettingsText) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "recordStartTimestampFormat": - err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileTextSettings. -func (l LogFileTextSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileTextSettings. -func (l *LogFileTextSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "recordStartTimestampFormat": - err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSource. -func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "filePatterns", l.FilePatterns) - populate(objectMap, "format", l.Format) - populate(objectMap, "name", l.Name) - populate(objectMap, "settings", l.Settings) - populate(objectMap, "streams", l.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSource. -func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "filePatterns": - err = unpopulate(val, "FilePatterns", &l.FilePatterns) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &l.Format) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &l.Settings) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &l.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSourceSettings. -func (l LogFilesDataSourceSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "text", l.Text) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSourceSettings. -func (l *LogFilesDataSourceSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "text": - err = unpopulate(val, "Text", &l.Text) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileCollection. -func (l LogProfileCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileCollection. -func (l *LogProfileCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileProperties. -func (l LogProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "categories", l.Categories) - populate(objectMap, "locations", l.Locations) - populate(objectMap, "retentionPolicy", l.RetentionPolicy) - populate(objectMap, "serviceBusRuleId", l.ServiceBusRuleID) - populate(objectMap, "storageAccountId", l.StorageAccountID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileProperties. -func (l *LogProfileProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "categories": - err = unpopulate(val, "Categories", &l.Categories) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &l.Locations) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) - delete(rawMsg, key) - case "serviceBusRuleId": - err = unpopulate(val, "ServiceBusRuleID", &l.ServiceBusRuleID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &l.StorageAccountID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResource. -func (l LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResource. -func (l *LogProfileResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &l.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &l.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &l.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResourcePatch. -func (l LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResourcePatch. -func (l *LogProfileResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &l.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogSettings. -func (l LogSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", l.Category) - populate(objectMap, "categoryGroup", l.CategoryGroup) - populate(objectMap, "enabled", l.Enabled) - populate(objectMap, "retentionPolicy", l.RetentionPolicy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogSettings. -func (l *LogSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &l.Category) - delete(rawMsg, key) - case "categoryGroup": - err = unpopulate(val, "CategoryGroup", &l.CategoryGroup) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &l.Enabled) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. -func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "callbackUrl", l.CallbackURL) - populate(objectMap, "name", l.Name) - populate(objectMap, "resourceId", l.ResourceID) - populate(objectMap, "useCommonAlertSchema", l.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicAppReceiver. -func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "callbackUrl": - err = unpopulate(val, "CallbackURL", &l.CallbackURL) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &l.ResourceID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &l.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogsIngestionEndpointSpec. -func (l LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", l.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogsIngestionEndpointSpec. -func (l *LogsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &l.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. -func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &m.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &m.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementEventAggregationCondition. -func (m ManagementEventAggregationCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventAggregationCondition. -func (m *ManagementEventAggregationCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementEventRuleCondition. -func (m ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", m.Aggregation) - populate(objectMap, "dataSource", m.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventRuleCondition. -func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &m.Aggregation) - delete(rawMsg, key) - case "dataSource": - m.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metadata. -func (m Metadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", m.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", m.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metadata. -func (m *Metadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &m.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &m.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataValue. -func (m MetadataValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataValue. -func (m *MetadataValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metric. -func (m Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "errorCode", m.ErrorCode) - populate(objectMap, "errorMessage", m.ErrorMessage) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "timeseries", m.Timeseries) - populate(objectMap, "type", m.Type) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metric. -func (m *Metric) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &m.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "timeseries": - err = unpopulate(val, "Timeseries", &m.Timeseries) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertAction. -func (m MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroupId", m.ActionGroupID) - populate(objectMap, "webHookProperties", m.WebHookProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertAction. -func (m *MetricAlertAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroupId": - err = unpopulate(val, "ActionGroupID", &m.ActionGroupID) - delete(rawMsg, key) - case "webHookProperties": - err = unpopulate(val, "WebHookProperties", &m.WebHookProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertCriteria. -func (m MetricAlertCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = m.ODataType - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertCriteria. -func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - m.AllOf, err = unmarshalMultiMetricCriteriaClassificationArray(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. -func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertProperties. -func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. -func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertPropertiesPatch. -func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResource. -func (m MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResource. -func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourceCollection. -func (m MetricAlertResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourceCollection. -func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. -func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourcePatch. -func (m *MetricAlertResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &m.AllOf) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatus. -func (m MetricAlertStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatus. -func (m *MetricAlertStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusCollection. -func (m MetricAlertStatusCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusCollection. -func (m *MetricAlertStatusCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusProperties. -func (m MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "status", m.Status) - populateDateTimeRFC3339(objectMap, "timestamp", m.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusProperties. -func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &m.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAvailability. -func (m MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "retention", m.Retention) - populate(objectMap, "timeGrain", m.TimeGrain) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAvailability. -func (m *MetricAvailability) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "retention": - err = unpopulate(val, "Retention", &m.Retention) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesProperties. -func (m MetricBaselinesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baselines", m.Baselines) - populate(objectMap, "interval", m.Interval) - populate(objectMap, "namespace", m.Namespace) - populate(objectMap, "timespan", m.Timespan) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesProperties. -func (m *MetricBaselinesProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baselines": - err = unpopulate(val, "Baselines", &m.Baselines) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &m.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &m.Namespace) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &m.Timespan) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesResponse. -func (m MetricBaselinesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesResponse. -func (m *MetricBaselinesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricCriteria. -func (m MetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricCriteria. -func (m *MetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDefinition. -func (m MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "id", m.ID) - populate(objectMap, "isDimensionRequired", m.IsDimensionRequired) - populate(objectMap, "metricAvailabilities", m.MetricAvailabilities) - populate(objectMap, "metricClass", m.MetricClass) - populate(objectMap, "name", m.Name) - populate(objectMap, "namespace", m.Namespace) - populate(objectMap, "primaryAggregationType", m.PrimaryAggregationType) - populate(objectMap, "resourceId", m.ResourceID) - populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinition. -func (m *MetricDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "isDimensionRequired": - err = unpopulate(val, "IsDimensionRequired", &m.IsDimensionRequired) - delete(rawMsg, key) - case "metricAvailabilities": - err = unpopulate(val, "MetricAvailabilities", &m.MetricAvailabilities) - delete(rawMsg, key) - case "metricClass": - err = unpopulate(val, "MetricClass", &m.MetricClass) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &m.Namespace) - delete(rawMsg, key) - case "primaryAggregationType": - err = unpopulate(val, "PrimaryAggregationType", &m.PrimaryAggregationType) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &m.ResourceID) - delete(rawMsg, key) - case "supportedAggregationTypes": - err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection. -func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinitionCollection. -func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDimension. -func (m MetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "values", m.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDimension. -func (m *MetricDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &m.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespace. -func (m MetricNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "classification", m.Classification) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespace. -func (m *MetricNamespace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "classification": - err = unpopulate(val, "Classification", &m.Classification) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection. -func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceCollection. -func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceName. -func (m MetricNamespaceName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "metricNamespaceName", m.MetricNamespaceName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceName. -func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "metricNamespaceName": - err = unpopulate(val, "MetricNamespaceName", &m.MetricNamespaceName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricSettings. -func (m MetricSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "retentionPolicy", m.RetentionPolicy) - populate(objectMap, "timeGrain", m.TimeGrain) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSettings. -func (m *MetricSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &m.RetentionPolicy) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricSingleDimension. -func (m MetricSingleDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSingleDimension. -func (m *MetricSingleDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. -func (m MetricTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "dividePerInstance", m.DividePerInstance) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) - populate(objectMap, "metricResourceUri", m.MetricResourceURI) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "statistic", m.Statistic) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - populate(objectMap, "timeGrain", m.TimeGrain) - populate(objectMap, "timeWindow", m.TimeWindow) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricTrigger. -func (m *MetricTrigger) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "dividePerInstance": - err = unpopulate(val, "DividePerInstance", &m.DividePerInstance) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "metricResourceLocation": - err = unpopulate(val, "MetricResourceLocation", &m.MetricResourceLocation) - delete(rawMsg, key) - case "metricResourceUri": - err = unpopulate(val, "MetricResourceURI", &m.MetricResourceURI) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "statistic": - err = unpopulate(val, "Statistic", &m.Statistic) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - case "timeWindow": - err = unpopulate(val, "TimeWindow", &m.TimeWindow) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricValue. -func (m MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "average", m.Average) - populate(objectMap, "count", m.Count) - populate(objectMap, "maximum", m.Maximum) - populate(objectMap, "minimum", m.Minimum) - populateDateTimeRFC3339(objectMap, "timeStamp", m.TimeStamp) - populate(objectMap, "total", m.Total) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue. -func (m *MetricValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "average": - err = unpopulate(val, "Average", &m.Average) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &m.Count) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &m.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &m.Minimum) - delete(rawMsg, key) - case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) - delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &m.Total) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metrics. -func (m Metrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "internalId", m.InternalID) - populate(objectMap, "prometheusQueryEndpoint", m.PrometheusQueryEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metrics. -func (m *Metrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "internalId": - err = unpopulate(val, "InternalID", &m.InternalID) - delete(rawMsg, key) - case "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &m.PrometheusQueryEndpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricsIngestionEndpointSpec. -func (m MetricsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", m.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricsIngestionEndpointSpec. -func (m *MetricsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &m.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MonitoringAccountDestination. -func (m MonitoringAccountDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", m.AccountID) - populate(objectMap, "accountResourceId", m.AccountResourceID) - populate(objectMap, "name", m.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringAccountDestination. -func (m *MonitoringAccountDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &m.AccountID) - delete(rawMsg, key) - case "accountResourceId": - err = unpopulate(val, "AccountResourceID", &m.AccountResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MultiMetricCriteria. -func (m MultiMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["criterionType"] = m.CriterionType - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. -func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. -func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertType", n.AlertType) - populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) - populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) - populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) - populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) - populate(objectMap, "emailReceivers", n.EmailReceivers) - populate(objectMap, "eventHubReceivers", n.EventHubReceivers) - populate(objectMap, "itsmReceivers", n.ItsmReceivers) - populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) - populate(objectMap, "smsReceivers", n.SmsReceivers) - populate(objectMap, "voiceReceivers", n.VoiceReceivers) - populate(objectMap, "webhookReceivers", n.WebhookReceivers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. -func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertType": - err = unpopulate(val, "AlertType", &n.AlertType) - delete(rawMsg, key) - case "armRoleReceivers": - err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) - delete(rawMsg, key) - case "automationRunbookReceivers": - err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) - delete(rawMsg, key) - case "azureAppPushReceivers": - err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) - delete(rawMsg, key) - case "azureFunctionReceivers": - err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) - delete(rawMsg, key) - case "emailReceivers": - err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) - delete(rawMsg, key) - case "eventHubReceivers": - err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) - delete(rawMsg, key) - case "itsmReceivers": - err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) - delete(rawMsg, key) - case "logicAppReceivers": - err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) - delete(rawMsg, key) - case "smsReceivers": - err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) - delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) - delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated. -func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated. -func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. -func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. -func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResultAutoGenerated. -func (o OperationListResultAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResultAutoGenerated. -func (o *OperationListResultAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. -func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) - populate(objectMap, "name", p.Name) - populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PerfCounterDataSource. -func (p *PerfCounterDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "counterSpecifiers": - err = unpopulate(val, "CounterSpecifiers", &p.CounterSpecifiers) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "samplingFrequencyInSeconds": - err = unpopulate(val, "SamplingFrequencyInSeconds", &p.SamplingFrequencyInSeconds) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlatformTelemetryDataSource. -func (p PlatformTelemetryDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformTelemetryDataSource. -func (p *PlatformTelemetryDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. -func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) - populate(objectMap, "scaleMode", p.ScaleMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveAutoscalePolicy. -func (p *PredictiveAutoscalePolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "scaleLookAheadTime": - err = unpopulate(val, "ScaleLookAheadTime", &p.ScaleLookAheadTime) - delete(rawMsg, key) - case "scaleMode": - err = unpopulate(val, "ScaleMode", &p.ScaleMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. -func (p PredictiveResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", p.Data) - populate(objectMap, "interval", p.Interval) - populate(objectMap, "metricName", p.MetricName) - populate(objectMap, "targetResourceId", p.TargetResourceID) - populate(objectMap, "timespan", p.Timespan) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveResponse. -func (p *PredictiveResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &p.Data) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &p.Interval) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &p.MetricName) - delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &p.Timespan) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveValue. -func (p PredictiveValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "timeStamp", p.TimeStamp) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveValue. -func (p *PredictiveValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &p.TimeStamp) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) - delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) - delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) - delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. -func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceId", p.ResourceID) - populate(objectMap, "scopeId", p.ScopeID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopedResource. -func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) - delete(rawMsg, key) - case "scopeId": - err = unpopulate(val, "ScopeID", &p.ScopeID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrometheusForwarderDataSource. -func (p PrometheusForwarderDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "labelIncludeFilter", p.LabelIncludeFilter) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusForwarderDataSource. -func (p *PrometheusForwarderDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "labelIncludeFilter": - err = unpopulate(val, "LabelIncludeFilter", &p.LabelIncludeFilter) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResourceAutoGenerated. -func (p ProxyResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceAutoGenerated. -func (p *ProxyResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Recurrence. -func (r Recurrence) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "frequency", r.Frequency) - populate(objectMap, "schedule", r.Schedule) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence. -func (r *Recurrence) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "frequency": - err = unpopulate(val, "Frequency", &r.Frequency) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &r.Schedule) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. -func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "days", r.Days) - populate(objectMap, "hours", r.Hours) - populate(objectMap, "minutes", r.Minutes) - populate(objectMap, "timeZone", r.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecurrentSchedule. -func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "hours": - err = unpopulate(val, "Hours", &r.Hours) - delete(rawMsg, key) - case "minutes": - err = unpopulate(val, "Minutes", &r.Minutes) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &r.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. -func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. -func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. -func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. -func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. -func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. -func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. -func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. -func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. -func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated5. -func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. -func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdate. -func (r *ResourceForUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &r.Identity) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdateIdentity. -func (r ResourceForUpdateIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) - populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdateIdentity. -func (r *ResourceForUpdateIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Response. -func (r Response) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", r.Cost) - populate(objectMap, "interval", r.Interval) - populate(objectMap, "namespace", r.Namespace) - populate(objectMap, "resourceregion", r.Resourceregion) - populate(objectMap, "timespan", r.Timespan) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Response. -func (r *Response) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &r.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &r.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &r.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &r.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &r.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResponseWithError. -func (r ResponseWithError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", r.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseWithError. -func (r *ResponseWithError) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &r.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "days", r.Days) - populate(objectMap, "enabled", r.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. -func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &r.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleAction. -func (r RuleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = r.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleAction. -func (r *RuleAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleCondition. -func (r RuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", r.DataSource) - objectMap["odata.type"] = r.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCondition. -func (r *RuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - r.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleDataSource. -func (r RuleDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = r.ODataType - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceUri", r.ResourceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleDataSource. -func (r *RuleDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. -func (r RuleEmailAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customEmails", r.CustomEmails) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - populate(objectMap, "sendToServiceOwners", r.SendToServiceOwners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEmailAction. -func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customEmails": - err = unpopulate(val, "CustomEmails", &r.CustomEmails) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "sendToServiceOwners": - err = unpopulate(val, "SendToServiceOwners", &r.SendToServiceOwners) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventClaimsDataSource. -func (r RuleManagementEventClaimsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", r.EmailAddress) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventClaimsDataSource. -func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &r.EmailAddress) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. -func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "claims", r.Claims) - populate(objectMap, "eventName", r.EventName) - populate(objectMap, "eventSource", r.EventSource) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "level", r.Level) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - populate(objectMap, "operationName", r.OperationName) - populate(objectMap, "resourceGroupName", r.ResourceGroupName) - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceProviderName", r.ResourceProviderName) - populate(objectMap, "resourceUri", r.ResourceURI) - populate(objectMap, "status", r.Status) - populate(objectMap, "subStatus", r.SubStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "claims": - err = unpopulate(val, "Claims", &r.Claims) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &r.EventName) - delete(rawMsg, key) - case "eventSource": - err = unpopulate(val, "EventSource", &r.EventSource) - delete(rawMsg, key) - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &r.Level) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &r.OperationName) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &r.ResourceGroupName) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &r.ResourceProviderName) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &r.SubStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. -func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "metricName", r.MetricName) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceUri", r.ResourceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &r.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResolveConfiguration. -func (r RuleResolveConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoResolved", r.AutoResolved) - populate(objectMap, "timeToResolve", r.TimeToResolve) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResolveConfiguration. -func (r *RuleResolveConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "autoResolved": - err = unpopulate(val, "AutoResolved", &r.AutoResolved) - delete(rawMsg, key) - case "timeToResolve": - err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleWebhookAction. -func (r RuleWebhookAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - populate(objectMap, "properties", r.Properties) - populate(objectMap, "serviceUri", r.ServiceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleWebhookAction. -func (r *RuleWebhookAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &r.ServiceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleAction. -func (s ScaleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cooldown", s.Cooldown) - populate(objectMap, "direction", s.Direction) - populate(objectMap, "type", s.Type) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleAction. -func (s *ScaleAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cooldown": - err = unpopulate(val, "Cooldown", &s.Cooldown) - delete(rawMsg, key) - case "direction": - err = unpopulate(val, "Direction", &s.Direction) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleCapacity. -func (s ScaleCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "default", s.Default) - populate(objectMap, "maximum", s.Maximum) - populate(objectMap, "minimum", s.Minimum) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleCapacity. -func (s *ScaleCapacity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "default": - err = unpopulate(val, "Default", &s.Default) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &s.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &s.Minimum) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleRule. -func (s ScaleRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "metricTrigger", s.MetricTrigger) - populate(objectMap, "scaleAction", s.ScaleAction) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRule. -func (s *ScaleRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "metricTrigger": - err = unpopulate(val, "MetricTrigger", &s.MetricTrigger) - delete(rawMsg, key) - case "scaleAction": - err = unpopulate(val, "ScaleAction", &s.ScaleAction) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleRuleMetricDimension. -func (s ScaleRuleMetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "DimensionName", s.DimensionName) - populate(objectMap, "Operator", s.Operator) - populate(objectMap, "Values", s.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRuleMetricDimension. -func (s *ScaleRuleMetricDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "DimensionName": - err = unpopulate(val, "DimensionName", &s.DimensionName) - delete(rawMsg, key) - case "Operator": - err = unpopulate(val, "Operator", &s.Operator) - delete(rawMsg, key) - case "Values": - err = unpopulate(val, "Values", &s.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. -func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", s.AllOf) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleCriteria. -func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &s.AllOf) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. -func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", s.Actions) - populate(objectMap, "autoMitigate", s.AutoMitigate) - populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) - populate(objectMap, "createdWithApiVersion", s.CreatedWithAPIVersion) - populate(objectMap, "criteria", s.Criteria) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "enabled", s.Enabled) - populate(objectMap, "evaluationFrequency", s.EvaluationFrequency) - populate(objectMap, "isLegacyLogAnalyticsRule", s.IsLegacyLogAnalyticsRule) - populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) - populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) - populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "ruleResolveConfiguration", s.RuleResolveConfiguration) - populate(objectMap, "scopes", s.Scopes) - populate(objectMap, "severity", s.Severity) - populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) - populate(objectMap, "targetResourceTypes", s.TargetResourceTypes) - populate(objectMap, "windowSize", s.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleProperties. -func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &s.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &s.AutoMitigate) - delete(rawMsg, key) - case "checkWorkspaceAlertsStorageConfigured": - err = unpopulate(val, "CheckWorkspaceAlertsStorageConfigured", &s.CheckWorkspaceAlertsStorageConfigured) - delete(rawMsg, key) - case "createdWithApiVersion": - err = unpopulate(val, "CreatedWithAPIVersion", &s.CreatedWithAPIVersion) - delete(rawMsg, key) - case "criteria": - err = unpopulate(val, "Criteria", &s.Criteria) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &s.EvaluationFrequency) - delete(rawMsg, key) - case "isLegacyLogAnalyticsRule": - err = unpopulate(val, "IsLegacyLogAnalyticsRule", &s.IsLegacyLogAnalyticsRule) - delete(rawMsg, key) - case "isWorkspaceAlertsStorageConfigured": - err = unpopulate(val, "IsWorkspaceAlertsStorageConfigured", &s.IsWorkspaceAlertsStorageConfigured) - delete(rawMsg, key) - case "muteActionsDuration": - err = unpopulate(val, "MuteActionsDuration", &s.MuteActionsDuration) - delete(rawMsg, key) - case "overrideQueryTimeRange": - err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) - delete(rawMsg, key) - case "ruleResolveConfiguration": - err = unpopulate(val, "RuleResolveConfiguration", &s.RuleResolveConfiguration) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &s.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "skipQueryValidation": - err = unpopulate(val, "SkipQueryValidation", &s.SkipQueryValidation) - delete(rawMsg, key) - case "targetResourceTypes": - err = unpopulate(val, "TargetResourceTypes", &s.TargetResourceTypes) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &s.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. -func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", s.Etag) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResource. -func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &s.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &s.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. -func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourceCollection. -func (s *ScheduledQueryRuleResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. -func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourcePatch. -func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &s.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResource. -func (s ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResource. -func (s *ScopedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResourceListResult. -func (s ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceListResult. -func (s *ScopedResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResourceProperties. -func (s ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "linkedResourceId", s.LinkedResourceID) - populate(objectMap, "provisioningState", s.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceProperties. -func (s *ScopedResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "linkedResourceId": - err = unpopulate(val, "LinkedResourceID", &s.LinkedResourceID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SenderAuthorization. -func (s SenderAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "action", s.Action) - populate(objectMap, "role", s.Role) - populate(objectMap, "scope", s.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SenderAuthorization. -func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - err = unpopulate(val, "Action", &s.Action) - delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &s.Role) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &s.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SingleBaseline. -func (s SingleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "highThresholds", s.HighThresholds) - populate(objectMap, "lowThresholds", s.LowThresholds) - populate(objectMap, "sensitivity", s.Sensitivity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SingleBaseline. -func (s *SingleBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "highThresholds": - err = unpopulate(val, "HighThresholds", &s.HighThresholds) - delete(rawMsg, key) - case "lowThresholds": - err = unpopulate(val, "LowThresholds", &s.LowThresholds) - delete(rawMsg, key) - case "sensitivity": - err = unpopulate(val, "Sensitivity", &s.Sensitivity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SingleMetricBaseline. -func (s SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SingleMetricBaseline. -func (s *SingleMetricBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SmsReceiver. -func (s SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "countryCode", s.CountryCode) - populate(objectMap, "name", s.Name) - populate(objectMap, "phoneNumber", s.PhoneNumber) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiver. -func (s *SmsReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &s.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SmsReceiverAutoGenerated. -func (s SmsReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "countryCode", s.CountryCode) - populate(objectMap, "name", s.Name) - populate(objectMap, "phoneNumber", s.PhoneNumber) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiverAutoGenerated. -func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &s.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageBlobDestination. -func (s StorageBlobDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerName", s.ContainerName) - populate(objectMap, "name", s.Name) - populate(objectMap, "storageAccountResourceId", s.StorageAccountResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDestination. -func (s *StorageBlobDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &s.ContainerName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &s.StorageAccountResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageTableDestination. -func (s StorageTableDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "storageAccountResourceId", s.StorageAccountResourceID) - populate(objectMap, "tableName", s.TableName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageTableDestination. -func (s *StorageTableDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &s.StorageAccountResourceID) - delete(rawMsg, key) - case "tableName": - err = unpopulate(val, "TableName", &s.TableName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. -func (s StreamDeclaration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "columns", s.Columns) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamDeclaration. -func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "columns": - err = unpopulate(val, "Columns", &s.Columns) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetric. -func (s SubscriptionScopeMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayDescription", s.DisplayDescription) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorMessage", s.ErrorMessage) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "timeseries", s.Timeseries) - populate(objectMap, "type", s.Type) - populate(objectMap, "unit", s.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetric. -func (s *SubscriptionScopeMetric) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "timeseries": - err = unpopulate(val, "Timeseries", &s.Timeseries) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinition. -func (s SubscriptionScopeMetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", s.Category) - populate(objectMap, "dimensions", s.Dimensions) - populate(objectMap, "displayDescription", s.DisplayDescription) - populate(objectMap, "id", s.ID) - populate(objectMap, "isDimensionRequired", s.IsDimensionRequired) - populate(objectMap, "metricAvailabilities", s.MetricAvailabilities) - populate(objectMap, "metricClass", s.MetricClass) - populate(objectMap, "name", s.Name) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "primaryAggregationType", s.PrimaryAggregationType) - populate(objectMap, "resourceId", s.ResourceID) - populate(objectMap, "supportedAggregationTypes", s.SupportedAggregationTypes) - populate(objectMap, "unit", s.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinition. -func (s *SubscriptionScopeMetricDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &s.Category) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &s.Dimensions) - delete(rawMsg, key) - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "isDimensionRequired": - err = unpopulate(val, "IsDimensionRequired", &s.IsDimensionRequired) - delete(rawMsg, key) - case "metricAvailabilities": - err = unpopulate(val, "MetricAvailabilities", &s.MetricAvailabilities) - delete(rawMsg, key) - case "metricClass": - err = unpopulate(val, "MetricClass", &s.MetricClass) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "primaryAggregationType": - err = unpopulate(val, "PrimaryAggregationType", &s.PrimaryAggregationType) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) - delete(rawMsg, key) - case "supportedAggregationTypes": - err = unpopulate(val, "SupportedAggregationTypes", &s.SupportedAggregationTypes) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinitionCollection. -func (s SubscriptionScopeMetricDefinitionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinitionCollection. -func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricResponse. -func (s SubscriptionScopeMetricResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", s.Cost) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "resourceregion", s.Resourceregion) - populate(objectMap, "timespan", s.Timespan) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricResponse. -func (s *SubscriptionScopeMetricResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &s.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &s.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. -func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", s.Aggregation) - populate(objectMap, "autoAdjustTimegrain", s.AutoAdjustTimegrain) - populate(objectMap, "filter", s.Filter) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "metricNames", s.MetricNames) - populate(objectMap, "metricNamespace", s.MetricNamespace) - populate(objectMap, "orderBy", s.OrderBy) - populate(objectMap, "resultType", s.ResultType) - populate(objectMap, "rollUpBy", s.RollUpBy) - populateTimeRFC3339(objectMap, "timespan", s.Timespan) - populate(objectMap, "top", s.Top) - populate(objectMap, "validateDimensions", s.ValidateDimensions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. -func (s *SubscriptionScopeMetricsRequestBodyParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &s.Aggregation) - delete(rawMsg, key) - case "autoAdjustTimegrain": - err = unpopulate(val, "AutoAdjustTimegrain", &s.AutoAdjustTimegrain) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &s.Filter) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "metricNames": - err = unpopulate(val, "MetricNames", &s.MetricNames) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &s.MetricNamespace) - delete(rawMsg, key) - case "orderBy": - err = unpopulate(val, "OrderBy", &s.OrderBy) - delete(rawMsg, key) - case "resultType": - err = unpopulate(val, "ResultType", &s.ResultType) - delete(rawMsg, key) - case "rollUpBy": - err = unpopulate(val, "RollUpBy", &s.RollUpBy) - delete(rawMsg, key) - case "timespan": - err = unpopulateTimeRFC3339(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "top": - err = unpopulate(val, "Top", &s.Top) - delete(rawMsg, key) - case "validateDimensions": - err = unpopulate(val, "ValidateDimensions", &s.ValidateDimensions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SyslogDataSource. -func (s SyslogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "facilityNames", s.FacilityNames) - populate(objectMap, "logLevels", s.LogLevels) - populate(objectMap, "name", s.Name) - populate(objectMap, "streams", s.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SyslogDataSource. -func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "facilityNames": - err = unpopulate(val, "FacilityNames", &s.FacilityNames) - delete(rawMsg, key) - case "logLevels": - err = unpopulate(val, "LogLevels", &s.LogLevels) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &s.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. -func (t *TagsResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroup. -func (t TenantActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureAppPushReceivers", t.AzureAppPushReceivers) - populate(objectMap, "emailReceivers", t.EmailReceivers) - populate(objectMap, "enabled", t.Enabled) - populate(objectMap, "groupShortName", t.GroupShortName) - populate(objectMap, "smsReceivers", t.SmsReceivers) - populate(objectMap, "voiceReceivers", t.VoiceReceivers) - populate(objectMap, "webhookReceivers", t.WebhookReceivers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroup. -func (t *TenantActionGroup) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureAppPushReceivers": - err = unpopulate(val, "AzureAppPushReceivers", &t.AzureAppPushReceivers) - delete(rawMsg, key) - case "emailReceivers": - err = unpopulate(val, "EmailReceivers", &t.EmailReceivers) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &t.Enabled) - delete(rawMsg, key) - case "groupShortName": - err = unpopulate(val, "GroupShortName", &t.GroupShortName) - delete(rawMsg, key) - case "smsReceivers": - err = unpopulate(val, "SmsReceivers", &t.SmsReceivers) - delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &t.VoiceReceivers) - delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &t.WebhookReceivers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupList. -func (t TenantActionGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupList. -func (t *TenantActionGroupList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupResource. -func (t TenantActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupResource. -func (t *TenantActionGroupResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. -func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionDetails", t.ActionDetails) - populate(objectMap, "completedTime", t.CompletedTime) - populate(objectMap, "context", t.Context) - populate(objectMap, "createdTime", t.CreatedTime) - populate(objectMap, "state", t.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponse. -func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionDetails": - err = unpopulate(val, "ActionDetails", &t.ActionDetails) - delete(rawMsg, key) - case "completedTime": - err = unpopulate(val, "CompletedTime", &t.CompletedTime) - delete(rawMsg, key) - case "context": - err = unpopulate(val, "Context", &t.Context) - delete(rawMsg, key) - case "createdTime": - err = unpopulate(val, "CreatedTime", &t.CreatedTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &t.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. -func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", t.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - populate(objectMap, "operator", t.Operator) - populate(objectMap, "threshold", t.Threshold) - populate(objectMap, "timeAggregation", t.TimeAggregation) - populate(objectMap, "windowSize", t.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdRuleCondition. -func (t *ThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - t.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &t.ODataType) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &t.Operator) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &t.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &t.TimeAggregation) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &t.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeSeriesBaseline. -func (t TimeSeriesBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", t.Aggregation) - populate(objectMap, "data", t.Data) - populate(objectMap, "dimensions", t.Dimensions) - populate(objectMap, "metadataValues", t.MetadataValues) - aux := make([]*dateTimeRFC3339, len(t.Timestamps), len(t.Timestamps)) - for i := 0; i < len(t.Timestamps); i++ { - aux[i] = (*dateTimeRFC3339)(t.Timestamps[i]) - } - populate(objectMap, "timestamps", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesBaseline. -func (t *TimeSeriesBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &t.Aggregation) - delete(rawMsg, key) - case "data": - err = unpopulate(val, "Data", &t.Data) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &t.Dimensions) - delete(rawMsg, key) - case "metadataValues": - err = unpopulate(val, "MetadataValues", &t.MetadataValues) - delete(rawMsg, key) - case "timestamps": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "Timestamps", &aux) - for _, au := range aux { - t.Timestamps = append(t.Timestamps, (*time.Time)(au)) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement. -func (t TimeSeriesElement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", t.Data) - populate(objectMap, "metadatavalues", t.Metadatavalues) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesElement. -func (t *TimeSeriesElement) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &t.Data) - delete(rawMsg, key) - case "metadatavalues": - err = unpopulate(val, "Metadatavalues", &t.Metadatavalues) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeWindow. -func (t TimeWindow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "end", t.End) - populateDateTimeRFC3339(objectMap, "start", t.Start) - populate(objectMap, "timeZone", t.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindow. -func (t *TimeWindow) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "end": - err = unpopulateDateTimeRFC3339(val, "End", &t.End) - delete(rawMsg, key) - case "start": - err = unpopulateDateTimeRFC3339(val, "Start", &t.Start) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &t.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "automationRunbookReceivers": + err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "azureFunctionReceivers": + err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "eventHubReceivers": + err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResourceAutoGenerated. -func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceAutoGenerated. -func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &n.IncidentReceivers) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "itsmReceivers": + err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "logicAppReceivers": + err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. -func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RuleResolveConfiguration. +func (r RuleResolveConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "autoResolved", r.AutoResolved) + populate(objectMap, "timeToResolve", r.TimeToResolve) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. -func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResolveConfiguration. +func (r *RuleResolveConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) + case "autoResolved": + err = unpopulate(val, "AutoResolved", &r.AutoResolved) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "timeToResolve": + err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. -func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. +func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "allOf", s.AllOf) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. -func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleCriteria. +func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "allOf": + err = unpopulate(val, "AllOf", &s.AllOf) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatus. -func (v VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. +func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "autoMitigate", s.AutoMitigate) + populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) + populate(objectMap, "createdWithApiVersion", s.CreatedWithAPIVersion) + populate(objectMap, "criteria", s.Criteria) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "evaluationFrequency", s.EvaluationFrequency) + populate(objectMap, "isLegacyLogAnalyticsRule", s.IsLegacyLogAnalyticsRule) + populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) + populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) + populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) + populate(objectMap, "resolveConfiguration", s.ResolveConfiguration) + populate(objectMap, "scopes", s.Scopes) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) + populate(objectMap, "targetResourceTypes", s.TargetResourceTypes) + populate(objectMap, "windowSize", s.WindowSize) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatus. -func (v *VMInsightsOnboardingStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleProperties. +func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) + case "actions": + err = unpopulate(val, "Actions", &s.Actions) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &s.AutoMitigate) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "checkWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "CheckWorkspaceAlertsStorageConfigured", &s.CheckWorkspaceAlertsStorageConfigured) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "createdWithApiVersion": + err = unpopulate(val, "CreatedWithAPIVersion", &s.CreatedWithAPIVersion) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatusProperties. -func (v VMInsightsOnboardingStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", v.Data) - populate(objectMap, "dataStatus", v.DataStatus) - populate(objectMap, "onboardingStatus", v.OnboardingStatus) - populate(objectMap, "resourceId", v.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatusProperties. -func (v *VMInsightsOnboardingStatusProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &v.Data) + case "criteria": + err = unpopulate(val, "Criteria", &s.Criteria) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "dataStatus": - err = unpopulate(val, "DataStatus", &v.DataStatus) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "onboardingStatus": - err = unpopulate(val, "OnboardingStatus", &v.OnboardingStatus) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &v.ResourceID) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &s.EvaluationFrequency) + delete(rawMsg, key) + case "isLegacyLogAnalyticsRule": + err = unpopulate(val, "IsLegacyLogAnalyticsRule", &s.IsLegacyLogAnalyticsRule) + delete(rawMsg, key) + case "isWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "IsWorkspaceAlertsStorageConfigured", &s.IsWorkspaceAlertsStorageConfigured) + delete(rawMsg, key) + case "muteActionsDuration": + err = unpopulate(val, "MuteActionsDuration", &s.MuteActionsDuration) + delete(rawMsg, key) + case "overrideQueryTimeRange": + err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) + delete(rawMsg, key) + case "resolveConfiguration": + err = unpopulate(val, "ResolveConfiguration", &s.ResolveConfiguration) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &s.Scopes) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "skipQueryValidation": + err = unpopulate(val, "SkipQueryValidation", &s.SkipQueryValidation) + delete(rawMsg, key) + case "targetResourceTypes": + err = unpopulate(val, "TargetResourceTypes", &s.TargetResourceTypes) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &s.WindowSize) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. -func (v VoiceReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. +func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "countryCode", v.CountryCode) - populate(objectMap, "name", v.Name) - populate(objectMap, "phoneNumber", v.PhoneNumber) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiver. -func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResource. +func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &v.CountryCode) + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &v.Name) + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VoiceReceiverAutoGenerated. -func (v VoiceReceiverAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. +func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "countryCode", v.CountryCode) - populate(objectMap, "name", v.Name) - populate(objectMap, "phoneNumber", v.PhoneNumber) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiverAutoGenerated. -func (v *VoiceReceiverAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourceCollection. +func (s *ScheduledQueryRuleResourceCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &v.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookNotification. -func (w WebhookNotification) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. +func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookNotification. -func (w *WebhookNotification) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourcePatch. +func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &w.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookReceiver. -func (w WebhookReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SmsReceiver. +func (s SmsReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identifierUri", w.IdentifierURI) - populate(objectMap, "name", w.Name) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "tenantId", w.TenantID) - populate(objectMap, "useAadAuth", w.UseAADAuth) - populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) + populate(objectMap, "countryCode", s.CountryCode) + populate(objectMap, "name", s.Name) + populate(objectMap, "phoneNumber", s.PhoneNumber) + populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiver. -func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiver. +func (s *SmsReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identifierUri": - err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + case "countryCode": + err = unpopulate(val, "CountryCode", &s.CountryCode) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "useAadAuth": - err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) + case "status": + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookReceiverAutoGenerated. -func (w WebhookReceiverAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identifierUri", w.IdentifierURI) - populate(objectMap, "name", w.Name) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "tenantId", w.TenantID) - populate(objectMap, "useAadAuth", w.UseAADAuth) - populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiverAutoGenerated. -func (w *WebhookReceiverAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identifierUri": - err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "useAadAuth": - err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebtestLocationAvailabilityCriteria. -func (w WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. +func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "componentId", w.ComponentID) - populate(objectMap, "failedLocationCount", w.FailedLocationCount) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - populate(objectMap, "webTestId", w.WebTestID) - if w.AdditionalProperties != nil { - for key, val := range w.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "actionDetails", t.ActionDetails) + populate(objectMap, "completedTime", t.CompletedTime) + populate(objectMap, "context", t.Context) + populate(objectMap, "createdTime", t.CreatedTime) + populate(objectMap, "state", t.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestLocationAvailabilityCriteria. -func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponse. +func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "componentId": - err = unpopulate(val, "ComponentID", &w.ComponentID) + case "actionDetails": + err = unpopulate(val, "ActionDetails", &t.ActionDetails) delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &w.FailedLocationCount) + case "completedTime": + err = unpopulate(val, "CompletedTime", &t.CompletedTime) delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &w.ODataType) + case "context": + err = unpopulate(val, "Context", &t.Context) delete(rawMsg, key) - case "webTestId": - err = unpopulate(val, "WebTestID", &w.WebTestID) + case "createdTime": + err = unpopulate(val, "CreatedTime", &t.CreatedTime) delete(rawMsg, key) - default: - if w.AdditionalProperties == nil { - w.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - w.AdditionalProperties[key] = aux - } + case "state": + err = unpopulate(val, "State", &t.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsEventLogDataSource. -func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", w.Name) - populate(objectMap, "streams", w.Streams) - populate(objectMap, "xPathQueries", w.XPathQueries) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsEventLogDataSource. -func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &w.Streams) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "xPathQueries": - err = unpopulate(val, "XPathQueries", &w.XPathQueries) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsFirewallLogsDataSource. -func (w WindowsFirewallLogsDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. +func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", w.Name) - populate(objectMap, "streams", w.Streams) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsFirewallLogsDataSource. -func (w *WindowsFirewallLogsDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. +func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &w.Name) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &w.Streams) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfo. -func (w WorkspaceInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. +func (v VoiceReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "properties", w.Properties) + populate(objectMap, "countryCode", v.CountryCode) + populate(objectMap, "name", v.Name) + populate(objectMap, "phoneNumber", v.PhoneNumber) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfo. -func (w *WorkspaceInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiver. +func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) + case "countryCode": + err = unpopulate(val, "CountryCode", &v.CountryCode) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfoProperties. -func (w WorkspaceInfoProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebhookReceiver. +func (w WebhookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customerId", w.CustomerID) + populate(objectMap, "identifierUri", w.IdentifierURI) + populate(objectMap, "managedIdentity", w.ManagedIdentity) + populate(objectMap, "name", w.Name) + populate(objectMap, "objectId", w.ObjectID) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "useAadAuth", w.UseAADAuth) + populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfoProperties. -func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiver. +func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -11120,8 +1797,29 @@ func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "customerId": - err = unpopulate(val, "CustomerID", &w.CustomerID) + case "identifierUri": + err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &w.ManagedIdentity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &w.ObjectID) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "useAadAuth": + err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -11152,7 +1850,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go deleted file mode 100644 index 1db6ae81d207..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// OperationsClient contains the methods for the Operations group. -// Don't use this type directly, use NewOperationsClient() instead. -type OperationsClient struct { - internal *arm.Client -} - -// NewOperationsClient creates a new instance of OperationsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsClient{ - internal: cl, - } - return client, nil -} - -// List - Lists all of the available operations from Microsoft.Insights provider. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-04-01 -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { - var err error - const operationName = "OperationsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperationsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go deleted file mode 100644 index 355e0f5525d9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,433 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationListResult = armmonitor.OperationListResult{ - // Value: []*armmonitor.Operation{ - // { - // Name: to.Ptr("Microsoft.Insights/Operations/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Operations read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Operations"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Metrics/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metrics read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metrics"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Incidents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule Incidents read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rule Incident resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/providers/Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity Log Alert Activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity Log Alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/EventCategories/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event category read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Event category"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/values/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management values read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/digestevents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management digest read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Digest events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log Definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaleup/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale up operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaledown/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale down operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Resolved/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule resolved"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Throttled/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule throttled"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Register/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Register Microsoft.Insights"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Microsoft.Insights"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks write"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks delete"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go deleted file mode 100644 index 1f4659654f7e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go +++ /dev/null @@ -1,89 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// OperationsForMonitorClient contains the methods for the OperationsForMonitor group. -// Don't use this type directly, use NewOperationsForMonitorClient() instead. -type OperationsForMonitorClient struct { - internal *arm.Client -} - -// NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewOperationsForMonitorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsForMonitorClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsForMonitorClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists available Operations for this Resource Provider -// -// Generated from API version 2021-06-03-preview -// - options - OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager -// method. -func (client *OperationsForMonitorClient) NewListPager(options *OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsForMonitorClientListResponse]{ - More: func(page OperationsForMonitorClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *OperationsForMonitorClientListResponse) (OperationsForMonitorClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsForMonitorClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return OperationsForMonitorClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, options *OperationsForMonitorClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Monitor/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *OperationsForMonitorClient) listHandleResponse(resp *http.Response) (OperationsForMonitorClientListResponse, error) { - result := OperationsForMonitorClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { - return OperationsForMonitorClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go deleted file mode 100644 index 19685e884442..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json -func ExampleOperationsForMonitorClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsForMonitorClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResultAutoGenerated = armmonitor.OperationListResultAutoGenerated{ - // Value: []*armmonitor.OperationAutoGenerated{ - // { - // Name: to.Ptr("microsoft.monitor/accounts/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/write"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Create or Update any Azure Monitor Workspace"), - // Operation: to.Ptr("Create or Update Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/delete"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Delete any Azure Monitor Workspace"), - // Operation: to.Ptr("Delete Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read Azure Monitor Workspace metrics"), - // Operation: to.Ptr("Read Azure Monitor Workspace metrics"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/data/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read metrics data in any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Metrics Data"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/options.go b/sdk/resourcemanager/monitor/armmonitor/options.go index b737f70d4922..bbdac48822ca 100644 --- a/sdk/resourcemanager/monitor/armmonitor/options.go +++ b/sdk/resourcemanager/monitor/armmonitor/options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -11,7 +8,7 @@ package armmonitor // ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions contains the optional parameters for the ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel // method. type ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -58,708 +55,6 @@ type ActionGroupsClientUpdateOptions struct { // placeholder for future optional parameters } -// ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate -// method. -type ActivityLogAlertsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete method. -type ActivityLogAlertsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. -type ActivityLogAlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager -// method. -type ActivityLogAlertsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager -// method. -type ActivityLogAlertsClientListBySubscriptionIDOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update method. -type ActivityLogAlertsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. -type ActivityLogsClientListOptions struct { - // Used to fetch events with only the given properties. - // 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 - Select *string -} - -// AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. -type AlertRuleIncidentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager -// method. -type AlertRuleIncidentsClientListByAlertRuleOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate method. -type AlertRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. -type AlertRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. -type AlertRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager -// method. -type AlertRulesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager -// method. -type AlertRulesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. -type AlertRulesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate -// method. -type AutoscaleSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete method. -type AutoscaleSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. -type AutoscaleSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager -// method. -type AutoscaleSettingsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager -// method. -type AutoscaleSettingsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update method. -type AutoscaleSettingsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create -// method. -type AzureMonitorWorkspacesClientCreateOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete -// method. -type AzureMonitorWorkspacesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get method. -type AzureMonitorWorkspacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager -// method. -type AzureMonitorWorkspacesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager -// method. -type AzureMonitorWorkspacesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update -// method. -type AzureMonitorWorkspacesClientUpdateOptions struct { - // The payload - AzureMonitorWorkspaceProperties *AzureMonitorWorkspaceResourceForUpdate -} - -// BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. -type BaselinesClientListOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // 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' " - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // 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' - Metricnames *string - - // Metric namespace to query metric definitions for. - Metricnamespace *string - - // Allows retrieving only metadata of the baseline. On data request all information is retrieved. - ResultType *ResultType - - // The list of sensitivities (comma separated) to retrieve. - Sensitivities *string - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string -} - -// DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create -// method. -type DataCollectionEndpointsClientCreateOptions struct { - // The payload - Body *DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete -// method. -type DataCollectionEndpointsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get method. -type DataCollectionEndpointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager -// method. -type DataCollectionEndpointsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager -// method. -type DataCollectionEndpointsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update -// method. -type DataCollectionEndpointsClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate -} - -// DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create -// method. -type DataCollectionRuleAssociationsClientCreateOptions struct { - // The payload - Body *DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete -// method. -type DataCollectionRuleAssociationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get -// method. -type DataCollectionRuleAssociationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager -// method. -type DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager -// method. -type DataCollectionRuleAssociationsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager -// method. -type DataCollectionRuleAssociationsClientListByRuleOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create method. -type DataCollectionRulesClientCreateOptions struct { - // The payload - Body *DataCollectionRuleResource -} - -// DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete method. -type DataCollectionRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. -type DataCollectionRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager -// method. -type DataCollectionRulesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager -// method. -type DataCollectionRulesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update method. -type DataCollectionRulesClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate -} - -// DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get -// method. -type DiagnosticSettingsCategoryClientGetOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager -// method. -type DiagnosticSettingsCategoryClientListOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate -// method. -type DiagnosticSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete method. -type DiagnosticSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. -type DiagnosticSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager method. -type DiagnosticSettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager method. -type EventCategoriesClientListOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate method. -type LogProfilesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. -type LogProfilesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. -type LogProfilesClientGetOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. -type LogProfilesClientListOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. -type LogProfilesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate method. -type MetricAlertsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. -type MetricAlertsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. -type MetricAlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager -// method. -type MetricAlertsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager -// method. -type MetricAlertsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. -type MetricAlertsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName -// method. -type MetricAlertsStatusClientListByNameOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. -type MetricAlertsStatusClientListOptions struct { - // placeholder for future optional parameters -} - -// MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager -// method. -type MetricDefinitionsClientListAtSubscriptionScopeOptions struct { - // Metric namespace where the metrics you want reside. - Metricnamespace *string -} - -// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager method. -type MetricDefinitionsClientListOptions struct { - // Metric namespace where the metrics you want reside. - Metricnamespace *string -} - -// MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager method. -type MetricNamespacesClientListOptions struct { - // The ISO 8601 conform Date start time from which to query for metric namespaces. - StartTime *string -} - -// MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope -// method. -type MetricsClientListAtSubscriptionScopeOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // 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 ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost -// method. -type MetricsClientListAtSubscriptionScopePostOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // Parameters serialized in the body - Body *SubscriptionScopeMetricsRequestBodyParameters - - // 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 ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. -type MetricsClientListOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // 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 ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *ResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager -// method. -type OperationsForMonitorClientListOptions struct { - // placeholder for future optional parameters -} - -// PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. -type PredictiveMetricClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope -// method. -type PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope -// method. -type PrivateLinkResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get -// method. -type PrivateLinkScopeOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate -// method. -type PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete -// method. -type PrivateLinkScopedResourcesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get -// method. -type PrivateLinkScopedResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager -// method. -type PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. -type PrivateLinkScopesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. -type PrivateLinkScopesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. -type PrivateLinkScopesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager -// method. -type PrivateLinkScopesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager method. -type PrivateLinkScopesClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags method. -type PrivateLinkScopesClientUpdateTagsOptions struct { - // placeholder for future optional parameters -} - // ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate // method. type ScheduledQueryRulesClientCreateOrUpdateOptions struct { @@ -792,61 +87,3 @@ type ScheduledQueryRulesClientListBySubscriptionOptions struct { type ScheduledQueryRulesClientUpdateOptions struct { // placeholder for future optional parameters } - -// TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate -// method. -type TenantActionGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete method. -type TenantActionGroupsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. -type TenantActionGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager -// method. -type TenantActionGroupsClientListByManagementGroupIDOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update method. -type TenantActionGroupsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager method. -type TenantActivityLogsClientListOptions struct { - // Reduces the set of data collected. - // The $filter is very restricted and allows only the following patterns. - // - List events for a resource group: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, - // Operation' and resourceGroupName eq ''. - // - List events for resource: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - // and resourceUri eq ''. - // - List events for a subscription: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation'. - // - List events for a resource provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, - // Operation' and resourceProvider eq ''. - // - List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - // eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, - // Operation' and correlationId eq ''. - // NOTE: No other syntax is allowed. - Filter *string - - // Used to fetch events with only the given properties. - // 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 - Select *string -} - -// VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus -// method. -type VMInsightsClientGetOnboardingStatusOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go deleted file mode 100644 index 1f0b3c87ddb2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import "encoding/json" - -func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b MetricAlertCriteriaClassification - switch m["odata.type"] { - case string(OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - b = &MetricAlertMultipleResourceMultipleMetricCriteria{} - case string(OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - b = &MetricAlertSingleResourceMultipleMetricCriteria{} - case string(OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - b = &WebtestLocationAvailabilityCriteria{} - default: - b = &MetricAlertCriteria{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMetricCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b MultiMetricCriteriaClassification - switch m["criterionType"] { - case string(CriterionTypeDynamicThresholdCriterion): - b = &DynamicMetricCriteria{} - case string(CriterionTypeStaticThresholdCriterion): - b = &MetricCriteria{} - default: - b = &MultiMetricCriteria{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([]MultiMetricCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]MultiMetricCriteriaClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalMultiMetricCriteriaClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleActionClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.RuleEmailAction": - b = &RuleEmailAction{} - case "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction": - b = &RuleWebhookAction{} - default: - b = &RuleAction{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]RuleActionClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalRuleActionClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleConditionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleConditionClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition": - b = &LocationThresholdRuleCondition{} - case "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition": - b = &ManagementEventRuleCondition{} - case "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition": - b = &ThresholdRuleCondition{} - default: - b = &RuleCondition{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalRuleDataSourceClassification(rawMsg json.RawMessage) (RuleDataSourceClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleDataSourceClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource": - b = &RuleManagementEventDataSource{} - case "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource": - b = &RuleMetricDataSource{} - default: - b = &RuleDataSource{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go deleted file mode 100644 index 698a72d55834..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PredictiveMetricClient contains the methods for the PredictiveMetric group. -// Don't use this type directly, use NewPredictiveMetricClient() instead. -type PredictiveMetricClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPredictiveMetricClient creates a new instance of PredictiveMetricClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PredictiveMetricClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PredictiveMetricClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - get predictive autoscale metric future data -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - timespan - The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. -// - interval - The interval (i.e. timegrain) of the query. -// - metricNamespace - Metric namespace to query metric definitions for. -// - metricName - 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' -// - aggregation - The list of aggregation types (comma separated) to retrieve. -// - options - PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. -func (client *PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (PredictiveMetricClientGetResponse, error) { - var err error - const operationName = "PredictiveMetricClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation, options) - if err != nil { - return PredictiveMetricClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PredictiveMetricClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PredictiveMetricClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("timespan", timespan) - reqQP.Set("interval", interval) - reqQP.Set("metricNamespace", metricNamespace) - reqQP.Set("metricName", metricName) - reqQP.Set("aggregation", aggregation) - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PredictiveMetricClient) getHandleResponse(resp *http.Response) (PredictiveMetricClientGetResponse, error) { - result := PredictiveMetricClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PredictiveResponse); err != nil { - return PredictiveMetricClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go deleted file mode 100644 index 71d9445a99f2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json -func ExamplePredictiveMetricClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPredictiveMetricClient().Get(ctx, "myRG", "vmss1-Autoscale-775", "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", "PT1H", "Microsoft.Compute/virtualMachineScaleSets", "PercentageCPU", "Total", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PredictiveResponse = armmonitor.PredictiveResponse{ - // Data: []*armmonitor.PredictiveValue{ - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:00:00.000Z"); return t}()), - // Value: to.Ptr[float64](123), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](120), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](88), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:03:00.000Z"); return t}()), - // Value: to.Ptr[float64](100), - // }}, - // Interval: to.Ptr("PT1H"), - // MetricName: to.Ptr("PercentageCPU"), - // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1"), - // Timespan: to.Ptr("2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go deleted file mode 100644 index 140bdc5484a6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ /dev/null @@ -1,344 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. -// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. -type PrivateEndpointConnectionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateEndpointConnectionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateEndpointConnectionsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a private endpoint connection. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err - } - return result, nil -} - -// ListByPrivateLinkScope - Gets all private endpoint connections on a private link scope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope -// method. -func (client *PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionsClient.ListByPrivateLinkScope" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err - } - resp, err := client.listByPrivateLinkScopeHandleResponse(httpResp) - return resp, err -} - -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse, error) { - result := PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go deleted file mode 100644 index beac5fb035f5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", armmonitor.PrivateEndpointConnection{ - Properties: &armmonitor.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionListResult = armmonitor.PrivateEndpointConnectionListResult{ - // Value: []*armmonitor.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go deleted file mode 100644 index 748423399549..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. -// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. -type PrivateLinkResourcesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkResourcesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - groupName - The name of the private link resource. -// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get -// method. -func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { - var err error - const operationName = "PrivateLinkResourcesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, groupName, options) - if err != nil { - return PrivateLinkResourcesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourcesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourcesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { - result := PrivateLinkResourcesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesClientGetResponse{}, err - } - return result, nil -} - -// ListByPrivateLinkScope - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope -// method. -func (client *PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (PrivateLinkResourcesClientListByPrivateLinkScopeResponse, error) { - var err error - const operationName = "PrivateLinkResourcesClient.ListByPrivateLinkScope" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - resp, err := client.listByPrivateLinkScopeHandleResponse(httpResp) - return resp, err -} - -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByPrivateLinkScopeResponse, error) { - result := PrivateLinkResourcesClientListByPrivateLinkScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go deleted file mode 100644 index 3d2730ab12e0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armmonitor.PrivateLinkResourceListResult{ - // Value: []*armmonitor.PrivateLinkResource{ - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmonitor.PrivateLinkResource{ - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go deleted file mode 100644 index b95b70511c0b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go +++ /dev/null @@ -1,344 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopedResourcesClient contains the methods for the PrivateLinkScopedResources group. -// Don't use this type directly, use NewPrivateLinkScopedResourcesClient() instead. -type PrivateLinkScopedResourcesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopedResourcesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopedResourcesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate -// method. -func (client *PrivateLinkScopedResourcesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, name, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopedResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopedResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopedResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, name, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateLinkScopedResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete -// method. -func (client *PrivateLinkScopedResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopedResourcesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopedResourcesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopedResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateLinkScopedResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a scoped resource in a private link scope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get -// method. -func (client *PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientGetOptions) (PrivateLinkScopedResourcesClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopedResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopedResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesClientGetResponse, error) { - result := PrivateLinkScopedResourcesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResource); err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - return result, nil -} - -// NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager -// method. -func (client *PrivateLinkScopedResourcesClient) NewListByPrivateLinkScopePager(resourceGroupName string, scopeName string, options *PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) *runtime.Pager[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]{ - More: func(page PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse) (PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) - }, nil) - if err != nil { - return PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{}, err - } - return client.listByPrivateLinkScopeHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, error) { - result := PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResourceListResult); err != nil { - return PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go deleted file mode 100644 index 00798ed9e730..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json -func ExamplePrivateLinkScopedResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopedResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceUpdate.json -func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", armmonitor.ScopedResource{ - Properties: &armmonitor.ScopedResourceProperties{ - LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceDelete.json -func ExamplePrivateLinkScopedResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json -func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopedResourcesClient().NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScopedResourceListResult = armmonitor.ScopedResourceListResult{ - // Value: []*armmonitor.ScopedResource{ - // { - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("other-scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/other-scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444/resourceGroups/MyWorkspaceResourceGroup/providers/Microsoft.OperationalInsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go deleted file mode 100644 index 9f73ea7a6bca..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go +++ /dev/null @@ -1,109 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopeOperationStatusClient contains the methods for the PrivateLinkScopeOperationStatus group. -// Don't use this type directly, use NewPrivateLinkScopeOperationStatusClient() instead. -type PrivateLinkScopeOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopeOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopeOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the status of an azure asynchronous operation associated with a private link scope operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - asyncOperationID - The operation Id. -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get -// method. -func (client *PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions) (PrivateLinkScopeOperationStatusClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopeOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, asyncOperationID, resourceGroupName, options) - if err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopeOperationStatusClient) getCreateRequest(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}" - if asyncOperationID == "" { - return nil, errors.New("parameter asyncOperationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopeOperationStatusClient) getHandleResponse(resp *http.Response) (PrivateLinkScopeOperationStatusClientGetResponse, error) { - result := PrivateLinkScopeOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go deleted file mode 100644 index d8612988e855..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json -func ExamplePrivateLinkScopeOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopeOperationStatusClient().Get(ctx, "713192d7-503f-477a-9cfe-4efc3ee2bd11", "MyResourceGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armmonitor.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T16:13:13.933Z"); return t}()), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopeOperationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T13:13:13.933Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go deleted file mode 100644 index 228ac97d775c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go +++ /dev/null @@ -1,438 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopesClient contains the methods for the PrivateLinkScopes group. -// Don't use this type directly, use NewPrivateLinkScopesClient() instead. -type PrivateLinkScopesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for -// InstrumentationKey nor AppId in the Put operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - azureMonitorPrivateLinkScopePayload - Properties that need to be specified to create or update a Azure Monitor PrivateLinkScope. -// - options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. -func (client *PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, options) - if err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureMonitorPrivateLinkScopePayload); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { - result := PrivateLinkScopesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// BeginDelete - Deletes a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. -func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. -func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (PrivateLinkScopesClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopesClientGetResponse, error) { - result := PrivateLinkScopesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. -// -// Generated from API version 2021-07-01-preview -// - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager -// method. -func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListResponse]{ - More: func(page PrivateLinkScopesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopesClientListResponse) (PrivateLinkScopesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopesClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return PrivateLinkScopesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, options *PrivateLinkScopesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) (PrivateLinkScopesClientListResponse, error) { - result := PrivateLinkScopesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesClientListResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Gets a list of Azure Monitor PrivateLinkScopes within a resource group. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager -// method. -func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) *runtime.Pager[PrivateLinkScopesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListByResourceGroupResponse]{ - More: func(page PrivateLinkScopesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopesClientListByResourceGroupResponse) (PrivateLinkScopesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return PrivateLinkScopesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkScopesClientListByResourceGroupResponse, error) { - result := PrivateLinkScopesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. -// - options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags -// method. -func (client *PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (PrivateLinkScopesClientUpdateTagsResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.UpdateTags" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, scopeName, privateLinkScopeTags, options) - if err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - resp, err := client.updateTagsHandleResponse(httpResp) - return resp, err -} - -// updateTagsCreateRequest creates the UpdateTags request. -func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { - return nil, err - } - return req, nil -} - -// updateTagsHandleResponse handles the UpdateTags response. -func (client *PrivateLinkScopesClient) updateTagsHandleResponse(resp *http.Response) (PrivateLinkScopesClientUpdateTagsResponse, error) { - result := PrivateLinkScopesClientUpdateTagsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go deleted file mode 100644 index d45d301cfd2a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,405 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json -func ExamplePrivateLinkScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-other-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopesClient().BeginDelete(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json -func ExamplePrivateLinkScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().Get(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().UpdateTags(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // "Tag2": to.Ptr("Value2"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go deleted file mode 100644 index 812a8e44cf92..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ /dev/null @@ -1,678 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel. -type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { - // The details of the test notification results. - TestNotificationDetailsResponse -} - -// ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. -type ActionGroupsClientCreateOrUpdateResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActionGroupsClientDeleteResponse contains the response from method ActionGroupsClient.Delete. -type ActionGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// ActionGroupsClientEnableReceiverResponse contains the response from method ActionGroupsClient.EnableReceiver. -type ActionGroupsClientEnableReceiverResponse struct { - // placeholder for future response values -} - -// ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. -type ActionGroupsClientGetResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel. -type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse struct { - // The details of the test notification results. - TestNotificationDetailsResponse -} - -// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.NewListByResourceGroupPager. -type ActionGroupsClientListByResourceGroupResponse struct { - // A list of action groups. - ActionGroupList -} - -// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.NewListBySubscriptionIDPager. -type ActionGroupsClientListBySubscriptionIDResponse struct { - // A list of action groups. - ActionGroupList -} - -// ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. -type ActionGroupsClientUpdateResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActivityLogAlertsClientCreateOrUpdateResponse contains the response from method ActivityLogAlertsClient.CreateOrUpdate. -type ActivityLogAlertsClientCreateOrUpdateResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogAlertsClientDeleteResponse contains the response from method ActivityLogAlertsClient.Delete. -type ActivityLogAlertsClientDeleteResponse struct { - // placeholder for future response values -} - -// ActivityLogAlertsClientGetResponse contains the response from method ActivityLogAlertsClient.Get. -type ActivityLogAlertsClientGetResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogAlertsClientListByResourceGroupResponse contains the response from method ActivityLogAlertsClient.NewListByResourceGroupPager. -type ActivityLogAlertsClientListByResourceGroupResponse struct { - // A list of Activity Log Alert rules. - AlertRuleList -} - -// ActivityLogAlertsClientListBySubscriptionIDResponse contains the response from method ActivityLogAlertsClient.NewListBySubscriptionIDPager. -type ActivityLogAlertsClientListBySubscriptionIDResponse struct { - // A list of Activity Log Alert rules. - AlertRuleList -} - -// ActivityLogAlertsClientUpdateResponse contains the response from method ActivityLogAlertsClient.Update. -type ActivityLogAlertsClientUpdateResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogsClientListResponse contains the response from method ActivityLogsClient.NewListPager. -type ActivityLogsClientListResponse struct { - // Represents collection of events. - EventDataCollection -} - -// AlertRuleIncidentsClientGetResponse contains the response from method AlertRuleIncidentsClient.Get. -type AlertRuleIncidentsClientGetResponse struct { - // An alert incident indicates the activation status of an alert rule. - Incident -} - -// AlertRuleIncidentsClientListByAlertRuleResponse contains the response from method AlertRuleIncidentsClient.NewListByAlertRulePager. -type AlertRuleIncidentsClientListByAlertRuleResponse struct { - // The List incidents operation response. - IncidentListResult -} - -// AlertRulesClientCreateOrUpdateResponse contains the response from method AlertRulesClient.CreateOrUpdate. -type AlertRulesClientCreateOrUpdateResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AlertRulesClientDeleteResponse contains the response from method AlertRulesClient.Delete. -type AlertRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// AlertRulesClientGetResponse contains the response from method AlertRulesClient.Get. -type AlertRulesClientGetResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AlertRulesClientListByResourceGroupResponse contains the response from method AlertRulesClient.NewListByResourceGroupPager. -type AlertRulesClientListByResourceGroupResponse struct { - // Represents a collection of alert rule resources. - AlertRuleResourceCollection -} - -// AlertRulesClientListBySubscriptionResponse contains the response from method AlertRulesClient.NewListBySubscriptionPager. -type AlertRulesClientListBySubscriptionResponse struct { - // Represents a collection of alert rule resources. - AlertRuleResourceCollection -} - -// AlertRulesClientUpdateResponse contains the response from method AlertRulesClient.Update. -type AlertRulesClientUpdateResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AutoscaleSettingsClientCreateOrUpdateResponse contains the response from method AutoscaleSettingsClient.CreateOrUpdate. -type AutoscaleSettingsClientCreateOrUpdateResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AutoscaleSettingsClientDeleteResponse contains the response from method AutoscaleSettingsClient.Delete. -type AutoscaleSettingsClientDeleteResponse struct { - // placeholder for future response values -} - -// AutoscaleSettingsClientGetResponse contains the response from method AutoscaleSettingsClient.Get. -type AutoscaleSettingsClientGetResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AutoscaleSettingsClientListByResourceGroupResponse contains the response from method AutoscaleSettingsClient.NewListByResourceGroupPager. -type AutoscaleSettingsClientListByResourceGroupResponse struct { - // Represents a collection of autoscale setting resources. - AutoscaleSettingResourceCollection -} - -// AutoscaleSettingsClientListBySubscriptionResponse contains the response from method AutoscaleSettingsClient.NewListBySubscriptionPager. -type AutoscaleSettingsClientListBySubscriptionResponse struct { - // Represents a collection of autoscale setting resources. - AutoscaleSettingResourceCollection -} - -// AutoscaleSettingsClientUpdateResponse contains the response from method AutoscaleSettingsClient.Update. -type AutoscaleSettingsClientUpdateResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AzureMonitorWorkspacesClientCreateResponse contains the response from method AzureMonitorWorkspacesClient.Create. -type AzureMonitorWorkspacesClientCreateResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.Delete. -type AzureMonitorWorkspacesClientDeleteResponse struct { - // placeholder for future response values -} - -// AzureMonitorWorkspacesClientGetResponse contains the response from method AzureMonitorWorkspacesClient.Get. -type AzureMonitorWorkspacesClientGetResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// AzureMonitorWorkspacesClientListByResourceGroupResponse contains the response from method AzureMonitorWorkspacesClient.NewListByResourceGroupPager. -type AzureMonitorWorkspacesClientListByResourceGroupResponse struct { - // A pageable list of resources - AzureMonitorWorkspaceResourceListResult -} - -// AzureMonitorWorkspacesClientListBySubscriptionResponse contains the response from method AzureMonitorWorkspacesClient.NewListBySubscriptionPager. -type AzureMonitorWorkspacesClientListBySubscriptionResponse struct { - // A pageable list of resources - AzureMonitorWorkspaceResourceListResult -} - -// AzureMonitorWorkspacesClientUpdateResponse contains the response from method AzureMonitorWorkspacesClient.Update. -type AzureMonitorWorkspacesClientUpdateResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// BaselinesClientListResponse contains the response from method BaselinesClient.NewListPager. -type BaselinesClientListResponse struct { - // A list of metric baselines. - MetricBaselinesResponse -} - -// DataCollectionEndpointsClientCreateResponse contains the response from method DataCollectionEndpointsClient.Create. -type DataCollectionEndpointsClientCreateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientDeleteResponse contains the response from method DataCollectionEndpointsClient.Delete. -type DataCollectionEndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionEndpointsClientGetResponse contains the response from method DataCollectionEndpointsClient.Get. -type DataCollectionEndpointsClientGetResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientListByResourceGroupResponse contains the response from method DataCollectionEndpointsClient.NewListByResourceGroupPager. -type DataCollectionEndpointsClientListByResourceGroupResponse struct { - // A pageable list of resources. - DataCollectionEndpointResourceListResult -} - -// DataCollectionEndpointsClientListBySubscriptionResponse contains the response from method DataCollectionEndpointsClient.NewListBySubscriptionPager. -type DataCollectionEndpointsClientListBySubscriptionResponse struct { - // A pageable list of resources. - DataCollectionEndpointResourceListResult -} - -// DataCollectionEndpointsClientUpdateResponse contains the response from method DataCollectionEndpointsClient.Update. -type DataCollectionEndpointsClientUpdateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionRuleAssociationsClientCreateResponse contains the response from method DataCollectionRuleAssociationsClient.Create. -type DataCollectionRuleAssociationsClientCreateResponse struct { - // Definition of generic ARM proxy resource. - DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientDeleteResponse contains the response from method DataCollectionRuleAssociationsClient.Delete. -type DataCollectionRuleAssociationsClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionRuleAssociationsClientGetResponse contains the response from method DataCollectionRuleAssociationsClient.Get. -type DataCollectionRuleAssociationsClientGetResponse struct { - // Definition of generic ARM proxy resource. - DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager. -type DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRuleAssociationsClientListByResourceResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByResourcePager. -type DataCollectionRuleAssociationsClientListByResourceResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRuleAssociationsClientListByRuleResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByRulePager. -type DataCollectionRuleAssociationsClientListByRuleResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRulesClientCreateResponse contains the response from method DataCollectionRulesClient.Create. -type DataCollectionRulesClientCreateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DataCollectionRulesClientDeleteResponse contains the response from method DataCollectionRulesClient.Delete. -type DataCollectionRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionRulesClientGetResponse contains the response from method DataCollectionRulesClient.Get. -type DataCollectionRulesClientGetResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DataCollectionRulesClientListByResourceGroupResponse contains the response from method DataCollectionRulesClient.NewListByResourceGroupPager. -type DataCollectionRulesClientListByResourceGroupResponse struct { - // A pageable list of resources. - DataCollectionRuleResourceListResult -} - -// DataCollectionRulesClientListBySubscriptionResponse contains the response from method DataCollectionRulesClient.NewListBySubscriptionPager. -type DataCollectionRulesClientListBySubscriptionResponse struct { - // A pageable list of resources. - DataCollectionRuleResourceListResult -} - -// DataCollectionRulesClientUpdateResponse contains the response from method DataCollectionRulesClient.Update. -type DataCollectionRulesClientUpdateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DiagnosticSettingsCategoryClientGetResponse contains the response from method DiagnosticSettingsCategoryClient.Get. -type DiagnosticSettingsCategoryClientGetResponse struct { - // The diagnostic settings category resource. - DiagnosticSettingsCategoryResource -} - -// DiagnosticSettingsCategoryClientListResponse contains the response from method DiagnosticSettingsCategoryClient.NewListPager. -type DiagnosticSettingsCategoryClientListResponse struct { - // Represents a collection of diagnostic setting category resources. - DiagnosticSettingsCategoryResourceCollection -} - -// DiagnosticSettingsClientCreateOrUpdateResponse contains the response from method DiagnosticSettingsClient.CreateOrUpdate. -type DiagnosticSettingsClientCreateOrUpdateResponse struct { - // The diagnostic setting resource. - DiagnosticSettingsResource -} - -// DiagnosticSettingsClientDeleteResponse contains the response from method DiagnosticSettingsClient.Delete. -type DiagnosticSettingsClientDeleteResponse struct { - // placeholder for future response values -} - -// DiagnosticSettingsClientGetResponse contains the response from method DiagnosticSettingsClient.Get. -type DiagnosticSettingsClientGetResponse struct { - // The diagnostic setting resource. - DiagnosticSettingsResource -} - -// DiagnosticSettingsClientListResponse contains the response from method DiagnosticSettingsClient.NewListPager. -type DiagnosticSettingsClientListResponse struct { - // Represents a collection of alert rule resources. - DiagnosticSettingsResourceCollection -} - -// EventCategoriesClientListResponse contains the response from method EventCategoriesClient.NewListPager. -type EventCategoriesClientListResponse struct { - // A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, Alert, Recommendation, - // Policy. - EventCategoryCollection -} - -// LogProfilesClientCreateOrUpdateResponse contains the response from method LogProfilesClient.CreateOrUpdate. -type LogProfilesClientCreateOrUpdateResponse struct { - // The log profile resource. - LogProfileResource -} - -// LogProfilesClientDeleteResponse contains the response from method LogProfilesClient.Delete. -type LogProfilesClientDeleteResponse struct { - // placeholder for future response values -} - -// LogProfilesClientGetResponse contains the response from method LogProfilesClient.Get. -type LogProfilesClientGetResponse struct { - // The log profile resource. - LogProfileResource -} - -// LogProfilesClientListResponse contains the response from method LogProfilesClient.NewListPager. -type LogProfilesClientListResponse struct { - // Represents a collection of log profiles. - LogProfileCollection -} - -// LogProfilesClientUpdateResponse contains the response from method LogProfilesClient.Update. -type LogProfilesClientUpdateResponse struct { - // The log profile resource. - LogProfileResource -} - -// MetricAlertsClientCreateOrUpdateResponse contains the response from method MetricAlertsClient.CreateOrUpdate. -type MetricAlertsClientCreateOrUpdateResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsClientDeleteResponse contains the response from method MetricAlertsClient.Delete. -type MetricAlertsClientDeleteResponse struct { - // placeholder for future response values -} - -// MetricAlertsClientGetResponse contains the response from method MetricAlertsClient.Get. -type MetricAlertsClientGetResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsClientListByResourceGroupResponse contains the response from method MetricAlertsClient.NewListByResourceGroupPager. -type MetricAlertsClientListByResourceGroupResponse struct { - // Represents a collection of alert rule resources. - MetricAlertResourceCollection -} - -// MetricAlertsClientListBySubscriptionResponse contains the response from method MetricAlertsClient.NewListBySubscriptionPager. -type MetricAlertsClientListBySubscriptionResponse struct { - // Represents a collection of alert rule resources. - MetricAlertResourceCollection -} - -// MetricAlertsClientUpdateResponse contains the response from method MetricAlertsClient.Update. -type MetricAlertsClientUpdateResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsStatusClientListByNameResponse contains the response from method MetricAlertsStatusClient.ListByName. -type MetricAlertsStatusClientListByNameResponse struct { - // Represents a collection of alert rule resources. - MetricAlertStatusCollection -} - -// MetricAlertsStatusClientListResponse contains the response from method MetricAlertsStatusClient.List. -type MetricAlertsStatusClientListResponse struct { - // Represents a collection of alert rule resources. - MetricAlertStatusCollection -} - -// MetricDefinitionsClientListAtSubscriptionScopeResponse contains the response from method MetricDefinitionsClient.NewListAtSubscriptionScopePager. -type MetricDefinitionsClientListAtSubscriptionScopeResponse struct { - // Represents collection of metric definitions. - SubscriptionScopeMetricDefinitionCollection -} - -// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.NewListPager. -type MetricDefinitionsClientListResponse struct { - // Represents collection of metric definitions. - MetricDefinitionCollection -} - -// MetricNamespacesClientListResponse contains the response from method MetricNamespacesClient.NewListPager. -type MetricNamespacesClientListResponse struct { - // Represents collection of metric namespaces. - MetricNamespaceCollection -} - -// MetricsClientListAtSubscriptionScopePostResponse contains the response from method MetricsClient.ListAtSubscriptionScopePost. -type MetricsClientListAtSubscriptionScopePostResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse -} - -// MetricsClientListAtSubscriptionScopeResponse contains the response from method MetricsClient.ListAtSubscriptionScope. -type MetricsClientListAtSubscriptionScopeResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse -} - -// MetricsClientListResponse contains the response from method MetricsClient.List. -type MetricsClientListResponse struct { - // The response to a metrics query. - Response -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - // Result of the request to list Microsoft.Insights operations. It contains a list of operations and a URL link to get the - // next set of results. - OperationListResult -} - -// OperationsForMonitorClientListResponse contains the response from method OperationsForMonitorClient.NewListPager. -type OperationsForMonitorClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResultAutoGenerated -} - -// PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. -type PredictiveMetricClientGetResponse struct { - // The response to a metrics query. - PredictiveResponse -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. -type PrivateEndpointConnectionsClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.ListByPrivateLinkScope. -type PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse struct { - // List of private endpoint connection associated with the specified storage account - PrivateEndpointConnectionListResult -} - -// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResponse struct { - // A private link resource - PrivateLinkResource -} - -// PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.ListByPrivateLinkScope. -type PrivateLinkResourcesClientListByPrivateLinkScopeResponse struct { - // A list of private link resources - PrivateLinkResourceListResult -} - -// PrivateLinkScopeOperationStatusClientGetResponse contains the response from method PrivateLinkScopeOperationStatusClient.Get. -type PrivateLinkScopeOperationStatusClientGetResponse struct { - // The status of operation. - OperationStatus -} - -// PrivateLinkScopedResourcesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopedResourcesClient.BeginCreateOrUpdate. -type PrivateLinkScopedResourcesClientCreateOrUpdateResponse struct { - // A private link scoped resource - ScopedResource -} - -// PrivateLinkScopedResourcesClientDeleteResponse contains the response from method PrivateLinkScopedResourcesClient.BeginDelete. -type PrivateLinkScopedResourcesClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateLinkScopedResourcesClientGetResponse contains the response from method PrivateLinkScopedResourcesClient.Get. -type PrivateLinkScopedResourcesClientGetResponse struct { - // A private link scoped resource - ScopedResource -} - -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager. -type PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse struct { - // A list of scoped resources in a private link scope. - ScopedResourceListResult -} - -// PrivateLinkScopesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopesClient.CreateOrUpdate. -type PrivateLinkScopesClientCreateOrUpdateResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.BeginDelete. -type PrivateLinkScopesClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateLinkScopesClientGetResponse contains the response from method PrivateLinkScopesClient.Get. -type PrivateLinkScopesClientGetResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. -type PrivateLinkScopesClientListByResourceGroupResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. - AzureMonitorPrivateLinkScopeListResult -} - -// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. -type PrivateLinkScopesClientListResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. - AzureMonitorPrivateLinkScopeListResult -} - -// PrivateLinkScopesClientUpdateTagsResponse contains the response from method PrivateLinkScopesClient.UpdateTags. -type PrivateLinkScopesClientUpdateTagsResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. -type ScheduledQueryRulesClientCreateOrUpdateResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// ScheduledQueryRulesClientDeleteResponse contains the response from method ScheduledQueryRulesClient.Delete. -type ScheduledQueryRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// ScheduledQueryRulesClientGetResponse contains the response from method ScheduledQueryRulesClient.Get. -type ScheduledQueryRulesClientGetResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.NewListByResourceGroupPager. -type ScheduledQueryRulesClientListByResourceGroupResponse struct { - // Represents a collection of scheduled query rule resources. - ScheduledQueryRuleResourceCollection -} - -// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.NewListBySubscriptionPager. -type ScheduledQueryRulesClientListBySubscriptionResponse struct { - // Represents a collection of scheduled query rule resources. - ScheduledQueryRuleResourceCollection -} - -// ScheduledQueryRulesClientUpdateResponse contains the response from method ScheduledQueryRulesClient.Update. -type ScheduledQueryRulesClientUpdateResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// TenantActionGroupsClientCreateOrUpdateResponse contains the response from method TenantActionGroupsClient.CreateOrUpdate. -type TenantActionGroupsClientCreateOrUpdateResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActionGroupsClientDeleteResponse contains the response from method TenantActionGroupsClient.Delete. -type TenantActionGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// TenantActionGroupsClientGetResponse contains the response from method TenantActionGroupsClient.Get. -type TenantActionGroupsClientGetResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActionGroupsClientListByManagementGroupIDResponse contains the response from method TenantActionGroupsClient.NewListByManagementGroupIDPager. -type TenantActionGroupsClientListByManagementGroupIDResponse struct { - // A list of tenant action groups. - TenantActionGroupList -} - -// TenantActionGroupsClientUpdateResponse contains the response from method TenantActionGroupsClient.Update. -type TenantActionGroupsClientUpdateResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.NewListPager. -type TenantActivityLogsClientListResponse struct { - // Represents collection of events. - EventDataCollection -} - -// VMInsightsClientGetOnboardingStatusResponse contains the response from method VMInsightsClient.GetOnboardingStatus. -type VMInsightsClientGetOnboardingStatusResponse struct { - // VM Insights onboarding status for a resource. - VMInsightsOnboardingStatus -} diff --git a/sdk/resourcemanager/monitor/armmonitor/responses.go b/sdk/resourcemanager/monitor/armmonitor/responses.go new file mode 100644 index 000000000000..2acdfb918ffc --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/responses.go @@ -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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmonitor + +// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel. +type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponse +} + +// ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. +type ActionGroupsClientCreateOrUpdateResponse struct { + // An action group resource. + ActionGroupResource +} + +// ActionGroupsClientDeleteResponse contains the response from method ActionGroupsClient.Delete. +type ActionGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ActionGroupsClientEnableReceiverResponse contains the response from method ActionGroupsClient.EnableReceiver. +type ActionGroupsClientEnableReceiverResponse struct { + // placeholder for future response values +} + +// ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. +type ActionGroupsClientGetResponse struct { + // An action group resource. + ActionGroupResource +} + +// ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel. +type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponse +} + +// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.NewListByResourceGroupPager. +type ActionGroupsClientListByResourceGroupResponse struct { + // A list of action groups. + ActionGroupList +} + +// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.NewListBySubscriptionIDPager. +type ActionGroupsClientListBySubscriptionIDResponse struct { + // A list of action groups. + ActionGroupList +} + +// ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. +type ActionGroupsClientUpdateResponse struct { + // An action group resource. + ActionGroupResource +} + +// ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. +type ScheduledQueryRulesClientCreateOrUpdateResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} + +// ScheduledQueryRulesClientDeleteResponse contains the response from method ScheduledQueryRulesClient.Delete. +type ScheduledQueryRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// ScheduledQueryRulesClientGetResponse contains the response from method ScheduledQueryRulesClient.Get. +type ScheduledQueryRulesClientGetResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} + +// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.NewListByResourceGroupPager. +type ScheduledQueryRulesClientListByResourceGroupResponse struct { + // Represents a collection of scheduled query rule resources. + ScheduledQueryRuleResourceCollection +} + +// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.NewListBySubscriptionPager. +type ScheduledQueryRulesClientListBySubscriptionResponse struct { + // Represents a collection of scheduled query rule resources. + ScheduledQueryRuleResourceCollection +} + +// ScheduledQueryRulesClientUpdateResponse contains the response from method ScheduledQueryRulesClient.Update. +type ScheduledQueryRulesClientUpdateResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 96c5d6d1a89d..2f94af79bf8a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Creates or updates a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - parameters - The parameters of the rule to create or update. @@ -75,7 +72,7 @@ func (client *ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, _ *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +91,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -115,7 +112,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http // Delete - Deletes a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientDeleteOptions contains the optional parameters for the ScheduledQueryRulesClient.Delete @@ -142,7 +139,7 @@ func (client *ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientDeleteOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *ScheduledQueryRulesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,7 +158,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +167,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context // Get - Retrieve an scheduled query rule definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientGetOptions contains the optional parameters for the ScheduledQueryRulesClient.Get method. @@ -197,7 +194,7 @@ func (client *ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientGetOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *ScheduledQueryRulesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -216,7 +213,7 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +230,7 @@ func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Retrieve scheduled query rule definitions in a resource group. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager // method. @@ -261,7 +258,7 @@ func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -276,7 +273,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +290,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager // method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { @@ -320,7 +317,7 @@ func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *Sch } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ScheduledQueryRulesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ScheduledQueryRulesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +328,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +346,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp * // Update - Update a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - parameters - The parameters of the rule to update. @@ -378,7 +375,7 @@ func (client *ScheduledQueryRulesClient) Update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, _ *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -397,7 +394,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go deleted file mode 100644 index 405112627130..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go +++ /dev/null @@ -1,859 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json -func ExampleScheduledQueryRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/MyResourceGroupName2/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json -func ExampleScheduledQueryRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListByResourceGroupPager("QueryResourceGroupName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Get(ctx, "QueryResourceGroupName", "perf", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Health check rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Heartbeat"), - Threshold: to.Ptr[float64](360), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Update(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResourcePatch{ - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Enabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(false), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go deleted file mode 100644 index 06e332a4dbb0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go +++ /dev/null @@ -1,349 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// TenantActionGroupsClient contains the methods for the TenantActionGroups group. -// Don't use this type directly, use NewTenantActionGroupsClient() instead. -type TenantActionGroupsClient struct { - internal *arm.Client -} - -// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewTenantActionGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActionGroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TenantActionGroupsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a new tenant action group or update an existing one. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - actionGroup - The tenant action group to create or use for the update. -// - options - TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate -// method. -func (client *TenantActionGroupsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (TenantActionGroupsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, actionGroup, options) - if err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TenantActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *TenantActionGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (TenantActionGroupsClientCreateOrUpdateResponse, error) { - result := TenantActionGroupsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a tenant action group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete -// method. -func (client *TenantActionGroupsClient) Delete(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (TenantActionGroupsClientDeleteResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientDeleteResponse{}, err - } - return TenantActionGroupsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a tenant action group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. -func (client *TenantActionGroupsClient) Get(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (TenantActionGroupsClientGetResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TenantActionGroupsClient) getCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *TenantActionGroupsClient) getHandleResponse(resp *http.Response) (TenantActionGroupsClientGetResponse, error) { - result := TenantActionGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListByManagementGroupIDPager - Get a list of all tenant action groups in a management group. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager -// method. -func (client *TenantActionGroupsClient) NewListByManagementGroupIDPager(managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) *runtime.Pager[TenantActionGroupsClientListByManagementGroupIDResponse] { - return runtime.NewPager(runtime.PagingHandler[TenantActionGroupsClientListByManagementGroupIDResponse]{ - More: func(page TenantActionGroupsClientListByManagementGroupIDResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *TenantActionGroupsClientListByManagementGroupIDResponse) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TenantActionGroupsClient.NewListByManagementGroupIDPager") - req, err := client.listByManagementGroupIDCreateRequest(ctx, managementGroupID, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, runtime.NewResponseError(resp) - } - return client.listByManagementGroupIDHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByManagementGroupIDCreateRequest creates the ListByManagementGroupID request. -func (client *TenantActionGroupsClient) listByManagementGroupIDCreateRequest(ctx context.Context, managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByManagementGroupIDHandleResponse handles the ListByManagementGroupID response. -func (client *TenantActionGroupsClient) listByManagementGroupIDHandleResponse(resp *http.Response) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { - result := TenantActionGroupsClientListByManagementGroupIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupList); err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - return result, nil -} - -// Update - Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - tenantActionGroupPatch - Parameters supplied to the operation. -// - options - TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update -// method. -func (client *TenantActionGroupsClient) Update(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (TenantActionGroupsClientUpdateResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, tenantActionGroupPatch, options) - if err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *TenantActionGroupsClient) updateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, tenantActionGroupPatch); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *TenantActionGroupsClient) updateHandleResponse(resp *http.Response) (TenantActionGroupsClientUpdateResponse, error) { - result := TenantActionGroupsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go deleted file mode 100644 index e63ca7241bbc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/createOrUpdateTenantActionGroup.json -func ExampleTenantActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.TenantActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.TenantActionGroup{ - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiverAutoGenerated{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - GroupShortName: to.Ptr("sample"), - SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/getTenantActionGroup.json -func ExampleTenantActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Get(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/deleteTenantActionGroup.json -func ExampleTenantActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantActionGroupsClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/patchTenantActionGroup.json -func ExampleTenantActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.ActionGroupPatchBodyAutoGenerated{ - Properties: &armmonitor.ActionGroupPatchAutoGenerated{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/listTenantActionGroups.json -func ExampleTenantActionGroupsClient_NewListByManagementGroupIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActionGroupsClient().NewListByManagementGroupIDPager("72f988bf-86f1-41af-91ab-2d7cd011db47", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TenantActionGroupList = armmonitor.TenantActionGroupList{ - // Value: []*armmonitor.TenantActionGroupResource{ - // { - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go deleted file mode 100644 index 5fba971cf4ba..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// TenantActivityLogsClient contains the methods for the TenantActivityLogs group. -// Don't use this type directly, use NewTenantActivityLogsClient() instead. -type TenantActivityLogsClient struct { - internal *arm.Client -} - -// NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActivityLogsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TenantActivityLogsClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Gets the Activity Logs for the Tenant. Everything that is applicable to the API to get the Activity Logs -// for the subscription is applicable to this API (the parameters, $filter, etc.). One thing to -// point out here is that this API does not retrieve the logs at the individual subscription of the tenant but only surfaces -// the logs that were generated at the tenant level. -// -// Generated from API version 2015-04-01 -// - options - TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager -// method. -func (client *TenantActivityLogsClient) NewListPager(options *TenantActivityLogsClientListOptions) *runtime.Pager[TenantActivityLogsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TenantActivityLogsClientListResponse]{ - More: func(page TenantActivityLogsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TenantActivityLogsClientListResponse) (TenantActivityLogsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TenantActivityLogsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return TenantActivityLogsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TenantActivityLogsClient) listCreateRequest(ctx context.Context, options *TenantActivityLogsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/eventtypes/management/values" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Select != nil { - reqQP.Set("$select", *options.Select) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *TenantActivityLogsClient) listHandleResponse(resp *http.Response) (TenantActivityLogsClientListResponse, error) { - result := TenantActivityLogsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return TenantActivityLogsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go deleted file mode 100644 index 21dd5bab2e23..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithoutFilterOrSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go index b3823502263e..fb66e0b1a522 100644 --- a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // 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. DO NOT EDIT. @@ -19,12 +16,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +41,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 @@ -84,72 +108,3 @@ func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) e *t = (*time.Time)(&aux) return nil } - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go deleted file mode 100644 index 61aa48ba6fc2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// VMInsightsClient contains the methods for the VMInsights group. -// Don't use this type directly, use NewVMInsightsClient() instead. -type VMInsightsClient struct { - internal *arm.Client -} - -// NewVMInsightsClient creates a new instance of VMInsightsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewVMInsightsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMInsightsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &VMInsightsClient{ - internal: cl, - } - return client, nil -} - -// GetOnboardingStatus - Retrieves the VM Insights onboarding status for the specified resource or resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-11-27-preview -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. -// - options - VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus -// method. -func (client *VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string, options *VMInsightsClientGetOnboardingStatusOptions) (VMInsightsClientGetOnboardingStatusResponse, error) { - var err error - const operationName = "VMInsightsClient.GetOnboardingStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOnboardingStatusCreateRequest(ctx, resourceURI, options) - if err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - resp, err := client.getOnboardingStatusHandleResponse(httpResp) - return resp, err -} - -// getOnboardingStatusCreateRequest creates the GetOnboardingStatus request. -func (client *VMInsightsClient) getOnboardingStatusCreateRequest(ctx context.Context, resourceURI string, options *VMInsightsClientGetOnboardingStatusOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-11-27-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOnboardingStatusHandleResponse handles the GetOnboardingStatus response. -func (client *VMInsightsClient) getOnboardingStatusHandleResponse(resp *http.Response) (VMInsightsClientGetOnboardingStatusResponse, error) { - result := VMInsightsClientGetOnboardingStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VMInsightsOnboardingStatus); err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go deleted file mode 100644 index 6834327911e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,219 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmScaleSetThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatHasNotYetReportedData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // }, - // DataStatus: to.Ptr(armmonitor.DataStatusNotPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusUnknown), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAResourceGroupThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForASubscriptionThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring-secondary"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("f096d163-206e-4abf-9db3-2c62af003d68"), - // }, - // }, - // }, - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87"), - // }, - // } -}