From 44207cee84904b319a25db3c35bcce12a5a7a4ab Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 20 May 2026 04:08:36 +0000 Subject: [PATCH 1/5] Configurations: 'specification/monitor/resource-manager/Microsoft.Insights/Insights/tspconfig.yaml', and CommitSHA: 'b26c3c253cff26dd05361e882dbcf1b324f27dfd' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6325130 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../monitor/armmonitor/CHANGELOG.md | 337 + .../monitor/armmonitor/README.md | 2 +- .../monitor/armmonitor/actiongroups_client.go | 382 +- .../actiongroups_client_example_test.go | 1825 +- .../armmonitor/activitylogalerts_client.go | 73 +- .../activitylogalerts_client_example_test.go | 767 +- .../monitor/armmonitor/activitylogs_client.go | 39 +- .../activitylogs_client_example_test.go | 218 +- .../armmonitor/alertruleincidents_client.go | 58 +- .../alertruleincidents_client_example_test.go | 50 +- .../monitor/armmonitor/alertrules_client.go | 413 - .../alertrules_client_example_test.go | 413 - .../monitor/armmonitor/autorest.md | 12 - .../armmonitor/autoscalesettings_client.go | 92 +- .../autoscalesettings_client_example_test.go | 1314 +- .../azuremonitorworkspaces_client.go | 416 - ...remonitorworkspaces_client_example_test.go | 376 - .../monitor/armmonitor/baselines_client.go | 62 +- .../baselines_client_example_test.go | 128 +- .../monitor/armmonitor/build.go | 7 - .../monitor/armmonitor/client_factory.go | 213 +- .../monitor/armmonitor/constants.go | 1213 +- .../datacollectionendpoints_client.go | 317 +- ...collectionendpoints_client_example_test.go | 735 +- .../datacollectionruleassociations_client.go | 104 +- ...ionruleassociations_client_example_test.go | 426 +- .../armmonitor/datacollectionrules_client.go | 104 +- ...datacollectionrules_client_example_test.go | 2048 ++- .../armmonitor/diagnosticsettings_client.go | 259 - .../diagnosticsettings_client_example_test.go | 401 - .../diagnosticsettingscategory_client.go | 150 - ...ticsettingscategory_client_example_test.go | 91 - .../armmonitor/eventcategories_client.go | 33 +- .../eventcategories_client_example_test.go | 32 +- .../armmonitor/fake/actiongroups_server.go | 287 +- .../fake/activitylogalerts_server.go | 102 +- .../armmonitor/fake/activitylogs_server.go | 65 +- .../fake/alertruleincidents_server.go | 66 +- .../armmonitor/fake/alertrules_server.go | 304 - .../fake/autoscalesettings_server.go | 92 +- .../fake/azuremonitorworkspaces_server.go | 318 - .../armmonitor/fake/baselines_server.go | 104 +- .../fake/datacollectionendpoints_server.go | 271 +- .../datacollectionruleassociations_server.go | 129 +- .../fake/datacollectionrules_server.go | 137 +- .../fake/diagnosticsettings_server.go | 223 - .../fake/diagnosticsettingscategory_server.go | 141 - .../armmonitor/fake/eventcategories_server.go | 54 +- .../monitor/armmonitor/fake/internal.go | 35 +- .../armmonitor/fake/logprofiles_server.go | 88 +- .../armmonitor/fake/metricalerts_server.go | 109 +- .../fake/metricalertsstatus_server.go | 62 +- .../fake/metricdefinitions_server.go | 85 +- .../fake/metricnamespaces_server.go | 62 +- .../monitor/armmonitor/fake/metrics_server.go | 294 +- .../armmonitor/fake/operations_server.go | 81 - .../fake/operationsformonitor_server.go | 93 - .../fake/predictivemetric_server.go | 74 +- .../fake/privateendpointconnections_server.go | 84 +- .../fake/privatelinkresources_server.go | 64 +- .../fake/privatelinkscopedresources_server.go | 94 +- .../privatelinkscopeoperationstatus_server.go | 62 +- .../fake/privatelinkscopes_server.go | 104 +- .../fake/scheduledqueryrule_server.go | 229 + .../fake/scheduledqueryrules_server.go | 102 +- .../monitor/armmonitor/fake/server_factory.go | 218 +- .../fake/servicediagnosticsettings_server.go | 191 + .../fake/tenantactiongroups_server.go | 266 - .../fake/tenantactivitylogs_server.go | 63 +- .../monitor/armmonitor/fake/time_rfc3339.go | 152 - .../armmonitor/fake/vminsights_server.go | 93 - sdk/resourcemanager/monitor/armmonitor/go.mod | 10 +- sdk/resourcemanager/monitor/armmonitor/go.sum | 20 +- .../monitor/armmonitor/interfaces.go | 35 +- .../monitor/armmonitor/logprofiles_client.go | 90 +- .../logprofiles_client_example_test.go | 355 +- .../monitor/armmonitor/metricalerts_client.go | 100 +- .../metricalerts_client_example_test.go | 2848 +-- .../armmonitor/metricalertsstatus_client.go | 27 +- .../metricalertsstatus_client_example_test.go | 69 +- .../armmonitor/metricdefinitions_client.go | 58 +- .../metricdefinitions_client_example_test.go | 14425 ++++++++-------- .../armmonitor/metricnamespaces_client.go | 32 +- .../metricnamespaces_client_example_test.go | 53 +- .../monitor/armmonitor/metrics_client.go | 154 +- .../armmonitor/metrics_client_example_test.go | 3077 ++-- .../monitor/armmonitor/models.go | 3109 ++-- .../monitor/armmonitor/models_serde.go | 6467 +++---- .../monitor/armmonitor/operations_client.go | 85 - .../operations_client_example_test.go | 430 - .../armmonitor/operationsformonitor_client.go | 86 - ...perationsformonitor_client_example_test.go | 98 - .../monitor/armmonitor/options.go | 435 +- .../monitor/armmonitor/polymorphic_helpers.go | 85 +- .../armmonitor/predictivemetric_client.go | 27 +- .../predictivemetric_client_example_test.go | 56 +- .../privateendpointconnections_client.go | 61 +- ...endpointconnections_client_example_test.go | 187 +- .../armmonitor/privatelinkresources_client.go | 31 +- ...rivatelinkresources_client_example_test.go | 124 +- .../privatelinkscopedresources_client.go | 66 +- ...linkscopedresources_client_example_test.go | 317 +- .../privatelinkscopeoperationstatus_client.go | 37 +- ...copeoperationstatus_client_example_test.go | 27 +- .../armmonitor/privatelinkscopes_client.go | 116 +- .../privatelinkscopes_client_example_test.go | 571 +- .../{response_types.go => responses.go} | 243 +- .../armmonitor/scheduledqueryrule_client.go | 249 + .../scheduledqueryrule_client_example_test.go | 150 + .../armmonitor/scheduledqueryrules_client.go | 70 +- ...scheduledqueryrules_client_example_test.go | 1429 +- .../servicediagnosticsettings_client.go | 213 + ...ediagnosticsettings_client_example_test.go | 230 + .../armmonitor/tenantactiongroups_client.go | 346 - .../tenantactiongroups_client_example_test.go | 422 - .../armmonitor/tenantactivitylogs_client.go | 22 +- .../tenantactivitylogs_client_example_test.go | 443 +- .../armmonitor/testdata/_metadata.json | 19 + .../monitor/armmonitor/time_rfc3339.go | 152 - .../monitor/armmonitor/tsp-location.yaml | 4 + .../monitor/armmonitor/version.go | 10 + .../monitor/armmonitor/vminsights_client.go | 89 - .../vminsights_client_example_test.go | 216 - 123 files changed, 27189 insertions(+), 28994 deletions(-) delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertrules_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/autorest.md delete mode 100644 sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/build.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/servicediagnosticsettings_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operations_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go rename sdk/resourcemanager/monitor/armmonitor/{response_types.go => responses.go} (75%) create mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/testdata/_metadata.json delete mode 100644 sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/tsp-location.yaml create mode 100644 sdk/resourcemanager/monitor/armmonitor/version.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/vminsights_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index c4347fe6a0d5..a915b36451dc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,342 @@ # Release History +## 1.0.0 (2026-05-20) +### Breaking Changes + +- Function `*DataCollectionEndpointsClient.Create` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions)` to `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, options *DataCollectionEndpointsClientCreateOptions)` +- Function `*DataCollectionEndpointsClient.Update` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions)` to `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body ResourceForUpdate, options *DataCollectionEndpointsClientUpdateOptions)` +- Function `*DataCollectionRuleAssociationsClient.Create` parameter(s) have been changed from `(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions)` to `(ctx context.Context, resourceURI string, associationName string, body DataCollectionRuleAssociationProxyOnlyResource, options *DataCollectionRuleAssociationsClientCreateOptions)` +- Function `*DataCollectionRulesClient.Create` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions)` to `(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body DataCollectionRuleResource, options *DataCollectionRulesClientCreateOptions)` +- Function `*DataCollectionRulesClient.Update` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions)` to `(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body ResourceForUpdate, options *DataCollectionRulesClientUpdateOptions)` +- Function `*PrivateLinkScopeOperationStatusClient.Get` parameter(s) have been changed from `(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions)` to `(ctx context.Context, resourceGroupName string, asyncOperationID string, options *PrivateLinkScopeOperationStatusClientGetOptions)` +- Type of `ActionList.ActionGroups` has been changed from `[]*ActionGroupAutoGenerated` to `[]*ActivityLogAlertActionGroup` +- Type of `AzureMonitorPrivateLinkScopeProperties.ProvisioningState` has been changed from `*string` to `*PrivateLinkScopeProvisioningState` +- Type of `DataCollectionEndpointResource.SystemData` has been changed from `*DataCollectionEndpointResourceSystemData` to `*SystemData` +- Type of `DataCollectionRuleAssociationProxyOnlyResource.SystemData` has been changed from `*DataCollectionRuleAssociationProxyOnlyResourceSystemData` to `*SystemData` +- Type of `DataCollectionRuleResource.SystemData` has been changed from `*DataCollectionRuleResourceSystemData` to `*SystemData` +- Type of `Metric.Unit` has been changed from `*Unit` to `*MetricUnit` +- Type of `ScopedResourceProperties.ProvisioningState` has been changed from `*string` to `*ScopedResourceProvisioningState` +- Type of `SubscriptionScopeMetricsRequestBodyParameters.Timespan` has been changed from `*time.Time` to `*string` +- Enum `ActionType` has been removed +- Enum `CategoryType` has been removed +- Enum `DataStatus` has been removed +- Enum `OnboardingStatus` has been removed +- Enum `Origin` has been removed +- Enum `ProvisioningState` has been removed +- Enum `PublicNetworkAccess` has been removed +- Enum `TimeAggregationOperator` has been removed +- Enum `Unit` 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 `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 `*ClientFactory.NewAlertRulesClient` has been removed +- Function `*ClientFactory.NewAzureMonitorWorkspacesClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsCategoryClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewOperationsForMonitorClient` has been removed +- Function `*ClientFactory.NewTenantActionGroupsClient` has been removed +- Function `*ClientFactory.NewVMInsightsClient` 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 `*LocationThresholdRuleCondition.GetRuleCondition` has been removed +- Function `*ManagementEventRuleCondition.GetRuleCondition` 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 `*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 `*ThresholdRuleCondition.GetRuleCondition` has been removed +- Function `NewVMInsightsClient` has been removed +- Function `*VMInsightsClient.GetOnboardingStatus` has been removed +- Struct `ActionGroupAutoGenerated` has been removed +- Struct `ActionGroupPatchAutoGenerated` has been removed +- Struct `ActionGroupPatchBodyAutoGenerated` has been removed +- Struct `AlertRule` 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 `AzureAppPushReceiverAutoGenerated` has been removed +- Struct `AzureMonitorMetricsDestination` 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 `AzureResource` has been removed +- Struct `AzureResourceAutoGenerated` has been removed +- Struct `ConfigurationAccessEndpointSpec` has been removed +- Struct `DataCollectionEndpoint` has been removed +- Struct `DataCollectionEndpointResourceSystemData` has been removed +- Struct `DataCollectionRule` has been removed +- Struct `DataCollectionRuleAssociation` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceSystemData` has been removed +- Struct `DataCollectionRuleResourceSystemData` has been removed +- Struct `DataContainer` has been removed +- Struct `DataImportSources` has been removed +- Struct `DataSourcesSpec` has been removed +- Struct `DefaultErrorResponse` has been removed +- Struct `DestinationsSpec` 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 `EmailReceiverAutoGenerated` has been removed +- Struct `Error` has been removed +- Struct `ErrorContract` has been removed +- Struct `ErrorContractAutoGenerated` has been removed +- Struct `ErrorDetailAutoGenerated` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ErrorResponseAdditionalInfo` has been removed +- Struct `ErrorResponseAutoGenerated` has been removed +- Struct `ErrorResponseAutoGenerated2` has been removed +- Struct `ErrorResponseCommonV2` has been removed +- Struct `ErrorResponseDetails` has been removed +- Struct `EventHubDataSource` has been removed +- Struct `FailoverConfigurationSpec` has been removed +- Struct `IngestionSettings` has been removed +- Struct `LocationThresholdRuleCondition` has been removed +- Struct `LogFileSettings` has been removed +- Struct `LogFileTextSettings` has been removed +- Struct `LogsIngestionEndpointSpec` has been removed +- Struct `ManagementEventAggregationCondition` has been removed +- Struct `ManagementEventRuleCondition` has been removed +- Struct `Metadata` has been removed +- Struct `Metrics` has been removed +- Struct `MetricsIngestionEndpointSpec` 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 `ProxyResource` has been removed +- Struct `ProxyResourceAutoGenerated` 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 `ResponseWithError` 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 `SmsReceiverAutoGenerated` has been removed +- Struct `SubscriptionScopeMetric` has been removed +- Struct `SubscriptionScopeMetricResponse` has been removed +- Struct `TenantActionGroup` has been removed +- Struct `TenantActionGroupList` has been removed +- Struct `TenantActionGroupResource` has been removed +- Struct `ThresholdRuleCondition` 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 `WebhookReceiverAutoGenerated` has been removed +- Struct `WorkspaceInfo` has been removed +- Struct `WorkspaceInfoProperties` has been removed +- Field `Body` of struct `DataCollectionEndpointsClientCreateOptions` has been removed +- Field `Body` of struct `DataCollectionEndpointsClientUpdateOptions` has been removed +- Field `Body` of struct `DataCollectionRuleAssociationsClientCreateOptions` has been removed +- Field `Body` of struct `DataCollectionRulesClientCreateOptions` has been removed +- Field `Body` of struct `DataCollectionRulesClientUpdateOptions` has been removed +- Field `CategoryGroup` of struct `LogSettings` has been removed +- Field `Category` of struct `MetricSettings` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopePostResponse` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopeResponse` 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 value `KnownLogFilesDataSourceFormatJSON` added to enum type `KnownLogFilesDataSourceFormat` +- New value `KnownSyslogDataSourceFacilityNamesAlert`, `KnownSyslogDataSourceFacilityNamesAudit`, `KnownSyslogDataSourceFacilityNamesClock`, `KnownSyslogDataSourceFacilityNamesFtp`, `KnownSyslogDataSourceFacilityNamesNopri`, `KnownSyslogDataSourceFacilityNamesNtp` added to enum type `KnownSyslogDataSourceFacilityNames` +- New value `OdatatypeMicrosoftAzureMonitorPromQLCriteria` added to enum type `Odatatype` +- New enum type `AccessRuleDirection` with values `AccessRuleDirectionInbound`, `AccessRuleDirectionOutbound` +- New enum type `IncidentManagementService` with values `IncidentManagementServiceIcm` +- New enum type `IssueType` with values `IssueTypeConfigurationPropagationFailure`, `IssueTypeMissingIdentityConfiguration`, `IssueTypeMissingPerimeterConfiguration`, `IssueTypeUnknown` +- New enum type `KnownAgentSettingName` with values `KnownAgentSettingNameMaxDiskQuotaInMB`, `KnownAgentSettingNameTags`, `KnownAgentSettingNameUseTimeReceivedForForwardedEvents` +- New enum type `KnownEtwProviderDataSourceLogLevel` with values `KnownEtwProviderDataSourceLogLevelCritical`, `KnownEtwProviderDataSourceLogLevelError`, `KnownEtwProviderDataSourceLogLevelInformational`, `KnownEtwProviderDataSourceLogLevelVerbose`, `KnownEtwProviderDataSourceLogLevelWarning` +- New enum type `KnownEtwProviderType` with values `KnownEtwProviderTypeEventSource`, `KnownEtwProviderTypeManifest` +- New enum type `KnownOtelLogsDataSourceStreams` with values `KnownOtelLogsDataSourceStreamsMicrosoftOTelLogs` +- New enum type `KnownOtelLogsDirectDataSourceStreams` with values `KnownOtelLogsDirectDataSourceStreamsMicrosoftOTelLogs` +- New enum type `KnownOtelTracesDataSourceStreams` with values `KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesEvents`, `KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesResources`, `KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesSpans` +- New enum type `KnownOtelTracesDirectDataSourceStreams` with values `KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesEvents`, `KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesResources`, `KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesSpans` +- New enum type `KnownPerformanceCountersOTelDataSourceStreams` with values `KnownPerformanceCountersOTelDataSourceStreamsMicrosoftOtelPerfMetrics` +- New enum type `KnownStorageBlobLookupType` with values `KnownStorageBlobLookupTypeCidr`, `KnownStorageBlobLookupTypeString` +- New enum type `KnownWindowsFirewallLogsDataSourceProfileFilter` with values `KnownWindowsFirewallLogsDataSourceProfileFilterDomain`, `KnownWindowsFirewallLogsDataSourceProfileFilterPrivate`, `KnownWindowsFirewallLogsDataSourceProfileFilterPublic` +- New enum type `NetworkSecurityPerimeterConfigurationProvisioningState` with values `NetworkSecurityPerimeterConfigurationProvisioningStateAccepted`, `NetworkSecurityPerimeterConfigurationProvisioningStateCanceled`, `NetworkSecurityPerimeterConfigurationProvisioningStateCreating`, `NetworkSecurityPerimeterConfigurationProvisioningStateDeleting`, `NetworkSecurityPerimeterConfigurationProvisioningStateFailed`, `NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded`, `NetworkSecurityPerimeterConfigurationProvisioningStateUpdating` +- New enum type `PrivateLinkScopeProvisioningState` with values `PrivateLinkScopeProvisioningStateCanceled`, `PrivateLinkScopeProvisioningStateDeleting`, `PrivateLinkScopeProvisioningStateFailed`, `PrivateLinkScopeProvisioningStateSucceeded` +- New enum type `ResourceAssociationAccessMode` with values `ResourceAssociationAccessModeAudit`, `ResourceAssociationAccessModeEnforced`, `ResourceAssociationAccessModeLearning` +- New enum type `SKUTier` with values `SKUTierBasic`, `SKUTierFree`, `SKUTierPremium`, `SKUTierStandard` +- New enum type `ScopedResourceKind` with values `ScopedResourceKindMetrics`, `ScopedResourceKindResource` +- New enum type `ScopedResourceProvisioningState` with values `ScopedResourceProvisioningStateCanceled`, `ScopedResourceProvisioningStateFailed`, `ScopedResourceProvisioningStateProvisioning`, `ScopedResourceProvisioningStateSucceeded` +- New enum type `Severity` with values `SeverityError`, `SeverityWarning` +- New function `*ActionGroupsClient.GetNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientGetNSPOptions) (ActionGroupsClientGetNSPResponse, error)` +- New function `*ActionGroupsClient.NewListNSPPager(resourceGroupName string, actionGroupName string, options *ActionGroupsClientListNSPOptions) *runtime.Pager[ActionGroupsClientListNSPResponse]` +- New function `*ActionGroupsClient.BeginReconcileNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*runtime.Poller[ActionGroupsClientReconcileNSPResponse], error)` +- New function `*ClientFactory.NewScheduledQueryRuleClient() *ScheduledQueryRuleClient` +- New function `*ClientFactory.NewServiceDiagnosticSettingsClient() *ServiceDiagnosticSettingsClient` +- New function `*DataCollectionEndpointsClient.GetNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientGetNSPOptions) (DataCollectionEndpointsClientGetNSPResponse, error)` +- New function `*DataCollectionEndpointsClient.NewListNSPPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientListNSPOptions) *runtime.Pager[DataCollectionEndpointsClientListNSPResponse]` +- New function `*DataCollectionEndpointsClient.BeginReconcileNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*runtime.Poller[DataCollectionEndpointsClientReconcileNSPResponse], error)` +- New function `*DynamicPromQLCriteria.GetMultiPromQLCriteria() *MultiPromQLCriteria` +- New function `*MultiPromQLCriteria.GetMultiPromQLCriteria() *MultiPromQLCriteria` +- New function `*PromQLCriteria.GetMetricAlertCriteria() *MetricAlertCriteria` +- New function `NewScheduledQueryRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRuleClient, error)` +- New function `*ScheduledQueryRuleClient.GetNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientGetNSPOptions) (ScheduledQueryRuleClientGetNSPResponse, error)` +- New function `*ScheduledQueryRuleClient.NewListNSPPager(resourceGroupName string, ruleName string, options *ScheduledQueryRuleClientListNSPOptions) *runtime.Pager[ScheduledQueryRuleClientListNSPResponse]` +- New function `*ScheduledQueryRuleClient.BeginReconcileNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*runtime.Poller[ScheduledQueryRuleClientReconcileNSPResponse], error)` +- New function `NewServiceDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceDiagnosticSettingsClient, error)` +- New function `*ServiceDiagnosticSettingsClient.CreateOrUpdate(ctx context.Context, resourceURI string, parameters ServiceDiagnosticSettingsResource, options *ServiceDiagnosticSettingsClientCreateOrUpdateOptions) (ServiceDiagnosticSettingsClientCreateOrUpdateResponse, error)` +- New function `*ServiceDiagnosticSettingsClient.Get(ctx context.Context, resourceURI string, options *ServiceDiagnosticSettingsClientGetOptions) (ServiceDiagnosticSettingsClientGetResponse, error)` +- New function `*ServiceDiagnosticSettingsClient.Update(ctx context.Context, resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResourcePatch, options *ServiceDiagnosticSettingsClientUpdateOptions) (ServiceDiagnosticSettingsClientUpdateResponse, error)` +- New function `*StaticPromQLCriteria.GetMultiPromQLCriteria() *MultiPromQLCriteria` +- New struct `AccessRule` +- New struct `AccessRuleProperties` +- New struct `AccessRulePropertiesSubscriptionsItem` +- New struct `ActivityLogAlertActionGroup` +- New struct `AdxDestination` +- New struct `AgentSetting` +- New struct `ApplicationInsights` +- New struct `DataCollectionEndpointResourceSKU` +- New struct `DataCollectionRuleAgentSettings` +- New struct `DataCollectionRuleDirectDataSources` +- New struct `DataCollectionRuleEndpoints` +- New struct `DataCollectionRuleIngestionQuotas` +- New struct `DataCollectionRuleReferences` +- New struct `DataCollectionRuleResourceSKU` +- New struct `DynamicPromQLCriteria` +- New struct `EtwProviderDataSource` +- New struct `IncidentReceiver` +- New struct `IncidentServiceConnection` +- New struct `IngestionQuotasLogs` +- New struct `MicrosoftFabricDestination` +- New struct `NetworkSecurityPerimeter` +- New struct `NetworkSecurityPerimeterConfiguration` +- New struct `NetworkSecurityPerimeterConfigurationListResult` +- New struct `NetworkSecurityPerimeterConfigurationProperties` +- New struct `NetworkSecurityProfile` +- New struct `OtelLogsDataSource` +- New struct `OtelLogsDataSourceResourceAttributeRouting` +- New struct `OtelLogsDirectDataSource` +- New struct `OtelMetricsDataSource` +- New struct `OtelMetricsDataSourceResourceAttributeRouting` +- New struct `OtelMetricsDirectDataSource` +- New struct `OtelTracesDataSource` +- New struct `OtelTracesDataSourceResourceAttributeRouting` +- New struct `OtelTracesDirectDataSource` +- New struct `PerformanceCountersOTelDataSource` +- New struct `PromQLCriteria` +- New struct `ProvisioningIssue` +- New struct `ProvisioningIssueProperties` +- New struct `QueryFailingPeriods` +- New struct `ReferencesSpecEnrichmentData` +- New struct `ResolveConfiguration` +- New struct `ResourceAssociation` +- New struct `ServiceDiagnosticSettings` +- New struct `ServiceDiagnosticSettingsResource` +- New struct `ServiceDiagnosticSettingsResourcePatch` +- New struct `StaticPromQLCriteria` +- New struct `StorageBlob` +- New field `IncidentReceivers` in struct `ActionGroup` +- New field `Identity` in struct `ActionGroupPatchBody` +- New field `Identity`, `SystemData` in struct `ActionGroupResource` +- New field `ActionProperties` in struct `Actions` +- New field `SystemData` in struct `ActivityLogAlertResource` +- New field `TenantScope` in struct `AlertRuleProperties` +- New field `ManagedIdentity` in struct `AutomationRunbookReceiver` +- New field `ManagedIdentity` in struct `AzureFunctionReceiver` +- New field `AlertSensitivity`, `CriterionType`, `IgnoreDataBefore`, `MinRecurrenceCount` in struct `Condition` +- New field `ProvisionedByImmutableID` in struct `DataCollectionEndpointMetadata` +- New field `SKU` in struct `DataCollectionEndpointResource` +- New field `ProvisionedByImmutableID` in struct `DataCollectionRuleAssociationMetadata` +- New field `SkipToken`, `Top` in struct `DataCollectionRuleAssociationsClientListByRuleOptions` +- New field `EtwProviders`, `OtelLogs`, `OtelMetrics`, `OtelTraces`, `PerformanceCountersOTel` in struct `DataCollectionRuleDataSources` +- New field `AzureDataExplorer`, `MicrosoftFabric` in struct `DataCollectionRuleDestinations` +- New field `ProvisionedByImmutableID` in struct `DataCollectionRuleMetadata` +- New field `SKU` in struct `DataCollectionRuleResource` +- New field `AgentSettings`, `DirectDataSources`, `Endpoints`, `IngestionQuotas`, `References` in struct `DataCollectionRuleResourceProperties` +- New field `DeleteAssociations` in struct `DataCollectionRulesClientDeleteOptions` +- New field `CaptureOverflow` in struct `DataFlow` +- New field `NextLink` in struct `EventCategoryCollection` +- New field `ManagedIdentity` in struct `EventHubReceiver` +- New field `TransformKql` in struct `IisLogsDataSource` +- New field `NextLink` in struct `IncidentListResult` +- New field `TransformKql` in struct `LogFilesDataSource` +- New field `NextLink` in struct `LogProfileCollection` +- New field `SystemData` in struct `LogProfileResource` +- New field `ManagedIdentity` in struct `LogicAppReceiver` +- New field `ActionProperties`, `CustomProperties`, `ResolveConfiguration` in struct `MetricAlertProperties` +- New field `ActionProperties`, `CustomProperties`, `ResolveConfiguration` in struct `MetricAlertPropertiesPatch` +- New field `Identity`, `SystemData` in struct `MetricAlertResource` +- New field `NextLink` in struct `MetricAlertResourceCollection` +- New field `Identity` in struct `MetricAlertResourcePatch` +- New field `NextLink` in struct `MetricBaselinesResponse` +- New field `NextLink` in struct `MetricDefinitionCollection` +- New field `NextLink` in struct `MetricNamespaceCollection` +- New field `Rollupby` in struct `MetricsClientListAtSubscriptionScopeOptions` +- New field `Rollupby` in struct `MetricsClientListAtSubscriptionScopePostOptions` +- New anonymous field `Response` in struct `MetricsClientListAtSubscriptionScopePostResponse` +- New anonymous field `Response` in struct `MetricsClientListAtSubscriptionScopeResponse` +- New field `Rollupby` in struct `MetricsClientListOptions` +- New field `IncidentReceivers` in struct `NotificationRequestBody` +- New field `TransformKql` in struct `PerfCounterDataSource` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `NextLink` in struct `PrivateLinkResourceListResult` +- New field `Kind` in struct `PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions` +- New field `CustomVMScrapeConfig` in struct `PrometheusForwarderDataSource` +- New field `ResolveConfiguration` in struct `ScheduledQueryRuleProperties` +- New field `Kind`, `SubscriptionLocation` in struct `ScopedResourceProperties` +- New field `NextLink` in struct `SubscriptionScopeMetricDefinitionCollection` +- New field `TransformKql` in struct `SyslogDataSource` +- New field `ManagedIdentity` in struct `WebhookReceiver` +- New field `TransformKql` in struct `WindowsEventLogDataSource` +- New field `ProfileFilter` in struct `WindowsFirewallLogsDataSource` + + ## 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 ce0b9f58b5bc..b5f94fd09c89 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // ActionGroupsClient contains the methods for the ActionGroups group. // Don't use this type directly, use NewActionGroupsClient() instead. +// +// Generated from API versions 2021-10-01, 2024-10-01-preview type ActionGroupsClient struct { internal *arm.Client subscriptionID string } // NewActionGroupsClient creates a new instance of ActionGroupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActionGroupsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ 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 // - 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 @@ -56,8 +55,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceL return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -69,8 +67,6 @@ 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 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" @@ -93,8 +89,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/createNotifications" +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") } @@ -112,9 +108,10 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, notificationRequest); err != nil { return nil, err } @@ -123,8 +120,6 @@ 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 // - 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. @@ -153,8 +148,12 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" +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 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") } @@ -163,18 +162,15 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, errors.New("parameter actionGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) - 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", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { return nil, err } @@ -192,8 +188,6 @@ 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 // - 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. @@ -219,8 +213,12 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" +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 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") } @@ -229,26 +227,19 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, errors.New("parameter actionGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) - 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", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // EnableReceiver - Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This // 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 // - 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. @@ -276,8 +267,12 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe" +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 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") } @@ -286,18 +281,14 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex return nil, errors.New("parameter actionGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) - 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", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, enableRequest); err != nil { return nil, err } @@ -306,8 +297,6 @@ 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 // - 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. @@ -334,8 +323,12 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" +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 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") } @@ -344,17 +337,13 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource return nil, errors.New("parameter actionGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) - 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", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -368,10 +357,75 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action return result, nil } +// GetNSP - Gets a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ActionGroupsClientGetNSPOptions contains the optional parameters for the ActionGroupsClient.GetNSP method. +func (client *ActionGroupsClient) GetNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientGetNSPOptions) (ActionGroupsClientGetNSPResponse, error) { + var err error + const operationName = "ActionGroupsClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ActionGroupsClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *ActionGroupsClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, _ *ActionGroupsClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + 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 actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *ActionGroupsClient) getNSPHandleResponse(resp *http.Response) (ActionGroupsClientGetNSPResponse, error) { + result := ActionGroupsClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return ActionGroupsClientGetNSPResponse{}, err + } + return result, nil +} + // 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 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationID - The notification id @@ -400,7 +454,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") @@ -423,8 +477,8 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -439,29 +493,26 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel } // NewListByResourceGroupPager - Get a list of all action groups in a resource group. -// -// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager // method. func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) *runtime.Pager[ActionGroupsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListByResourceGroupResponse]{ More: func(page ActionGroupsClientListByResourceGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ActionGroupsClientListByResourceGroupResponse) (ActionGroupsClientListByResourceGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActionGroupsClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ActionGroupsClientListByResourceGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 ActionGroupsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ActionGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -469,23 +520,23 @@ func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) +func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups" 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", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -500,28 +551,25 @@ 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 // - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager // method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListBySubscriptionIDResponse]{ More: func(page ActionGroupsClientListBySubscriptionIDResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ActionGroupsClientListBySubscriptionIDResponse) (ActionGroupsClientListBySubscriptionIDResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActionGroupsClient.NewListBySubscriptionIDPager") - req, err := client.listBySubscriptionIDCreateRequest(ctx, options) - if err != nil { - return ActionGroupsClientListBySubscriptionIDResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 ActionGroupsClientListBySubscriptionIDResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ActionGroupsClientListBySubscriptionIDResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionIDHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -529,7 +577,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") @@ -540,8 +588,8 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -555,10 +603,147 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. return result, nil } +// NewListNSPPager - Gets a list of NSP configurations for specified action group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientListNSPOptions contains the optional parameters for the ActionGroupsClient.NewListNSPPager +// method. +func (client *ActionGroupsClient) NewListNSPPager(resourceGroupName string, actionGroupName string, options *ActionGroupsClientListNSPOptions) *runtime.Pager[ActionGroupsClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListNSPResponse]{ + More: func(page ActionGroupsClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ActionGroupsClientListNSPResponse) (ActionGroupsClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActionGroupsClient.NewListNSPPager") + 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.listNSPCreateRequest(ctx, resourceGroupName, actionGroupName, options) + }, nil) + if err != nil { + return ActionGroupsClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *ActionGroupsClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, _ *ActionGroupsClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations" + 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 actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *ActionGroupsClient) listNSPHandleResponse(resp *http.Response) (ActionGroupsClientListNSPResponse, error) { + result := ActionGroupsClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return ActionGroupsClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconciles a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ActionGroupsClientBeginReconcileNSPOptions contains the optional parameters for the ActionGroupsClient.BeginReconcileNSP +// method. +func (client *ActionGroupsClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*runtime.Poller[ActionGroupsClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ActionGroupsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ActionGroupsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconciles a specified NSP configuration for specified action group. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ActionGroupsClient) reconcileNSP(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *ActionGroupsClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "ActionGroupsClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, actionGroupName, networkSecurityPerimeterConfigurationName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *ActionGroupsClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, _ *ActionGroupsClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + 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 actionGroupName == "" { + return nil, errors.New("parameter actionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionGroupName}", url.PathEscape(actionGroupName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + // 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 // - 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. @@ -586,8 +771,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" +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") } @@ -605,9 +790,10 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20241001Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroupPatch); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go index 493e0e5fc3cb..1c5aa0a2aab2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go @@ -1,64 +1,302 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2024-10-01-preview/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("11111111-1111-1111-1111-111111111111", 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"), + ManagedIdentity: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + 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"), + ManagedIdentity: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + 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 poll 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 = armmonitor.ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse{ + // 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: 2024-10-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewActionGroupsClient().CreateOrUpdate(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupResource{ + Identity: &armmonitor.ManagedServiceIdentity{ + Type: to.Ptr(armmonitor.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armmonitor.UserAssignedIdentity{ + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": {}, + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": {}, + }, + }, 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), + ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), 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"), + ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), UseCommonAlertSchema: to.Ptr(true), - }}, + }, + }, EmailReceivers: []*armmonitor.EmailReceiver{ { Name: to.Ptr("John Doe's email"), @@ -69,17 +307,39 @@ func ExampleActionGroupsClient_CreateOrUpdate() { 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"), + ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, + }, + }, GroupShortName: to.Ptr("sample"), + IncidentReceivers: []*armmonitor.IncidentReceiver{ + { + Name: to.Ptr("IncidentAction"), + Connection: &armmonitor.IncidentServiceConnection{ + Name: to.Ptr("IncidentConnection"), + ID: to.Ptr("8be638e7-1419-42d4-a059-437a5f4f4e4e"), + }, + IncidentManagementService: to.Ptr(armmonitor.IncidentManagementServiceIcm), + Mappings: map[string]*string{ + "icm.automitigationenabled": to.Ptr("true"), + "icm.correlationid": to.Ptr("${data.essentials.signalType}://${data.essentials.originAlertId}"), + "icm.monitorid": to.Ptr("${data.essentials.alertRule}"), + "icm.occurringlocation.environment": to.Ptr("PROD"), + "icm.routingid": to.Ptr("${data.essentials.monitoringService}://${data.essentials.signalType}"), + "icm.title": to.Ptr("${data.essentials.severity}:${data.essentials.monitorCondition} ${data.essentials.monitoringService}:${data.essentials.signalType} ${data.essentials.alertTargetIds}"), + "icm.tsgid": to.Ptr("https://microsoft.com"), + }, + }, + }, ItsmReceivers: []*armmonitor.ItsmReceiver{ { Name: to.Ptr("Sample itsm"), @@ -87,14 +347,17 @@ func ExampleActionGroupsClient_CreateOrUpdate() { 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"), + ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), 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"), @@ -105,13 +368,15 @@ func ExampleActionGroupsClient_CreateOrUpdate() { 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"), @@ -121,13 +386,16 @@ func ExampleActionGroupsClient_CreateOrUpdate() { { Name: to.Ptr("Sample webhook 2"), IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), + ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), 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), - }}, + }, + }, }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -135,546 +403,388 @@ func ExampleActionGroupsClient_CreateOrUpdate() { // 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), + // res = armmonitor.ActionGroupsClientCreateOrUpdateResponse{ + // 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"), + // Identity: &armmonitor.ManagedServiceIdentity{ + // Type: to.Ptr(armmonitor.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armmonitor.UserAssignedIdentity{ + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("73525f7b-16f5-439f-b150-e6f737b8cb16"), + // PrincipalID: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // }, + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("4dfa770d-290d-465b-ad06-4a787b65c641"), + // PrincipalID: to.Ptr("92b72e3e-dc08-4697-8643-32426387ebce"), + // }, // }, - // { - // 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), + // }, + // Location: to.Ptr("Global"), + // Properties: &armmonitor.ActionGroup{ + // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ + // { + // Name: to.Ptr("Sample armRole"), + // RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), + // UseCommonAlertSchema: to.Ptr(true), + // }, // }, - // { - // 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), + // 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), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // 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"), + // }, // }, - // { - // 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), - // }}, + // 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(""), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // 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"), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), + // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), + // UseCommonAlertSchema: to.Ptr(false), + // }, + // }, + // GroupShortName: to.Ptr("sample"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // { + // Name: to.Ptr("IncidentAction"), + // Connection: &armmonitor.IncidentServiceConnection{ + // Name: to.Ptr("IncidentConnection"), + // ID: to.Ptr("8be638e7-1419-42d4-a059-437a5f4f4e4e"), + // }, + // IncidentManagementService: to.Ptr(armmonitor.IncidentManagementServiceIcm), + // Mappings: map[string]*string{ + // "icm.automitigationenabled": to.Ptr("true"), + // "icm.correlationid": to.Ptr("${data.essentials.signalType}://${data.essentials.originAlertId}"), + // "icm.monitorid": to.Ptr("${data.essentials.alertRule}"), + // "icm.occurringlocation.environment": to.Ptr("PROD"), + // "icm.routingid": to.Ptr("${data.essentials.monitoringService}://${data.essentials.signalType}"), + // "icm.title": to.Ptr("${data.essentials.severity}:${data.essentials.monitorCondition} ${data.essentials.monitoringService}:${data.essentials.signalType} ${data.essentials.alertTargetIds}"), + // "icm.tsgid": to.Ptr("https://microsoft.com"), + // }, + // }, + // }, + // 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"), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // 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"), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // 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), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// 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() { +// Generated from example definition: 2024-10-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewActionGroupsClient().Get(ctx, "Default-NotificationRules", "SampleActionGroup", nil) + res, err := clientFactory.NewActionGroupsClient().Delete(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), - // }}, - // }, + // res = armmonitor.ActionGroupsClientDeleteResponse{ // } } -// 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() { +// Generated from example definition: 2024-10-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewActionGroupsClient().Delete(ctx, "Default-NotificationRules", "SampleActionGroup", nil) + res, 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) } + // 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 = armmonitor.ActionGroupsClientEnableReceiverResponse{ + // } } -// 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() { +// Generated from example definition: 2024-10-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", 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) + 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{ - // "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), + // res = armmonitor.ActionGroupsClientGetResponse{ + // 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"), + // Identity: &armmonitor.ManagedServiceIdentity{ + // Type: to.Ptr(armmonitor.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armmonitor.UserAssignedIdentity{ + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("73525f7b-16f5-439f-b150-e6f737b8cb16"), + // PrincipalID: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // }, + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("4dfa770d-290d-465b-ad06-4a787b65c641"), + // PrincipalID: to.Ptr("92b72e3e-dc08-4697-8643-32426387ebce"), + // }, // }, - // { - // 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), + // Location: to.Ptr("Global"), + // Properties: &armmonitor.ActionGroup{ + // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ // }, - // { - // 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), + // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ // }, - // { - // 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), - // }}, + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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"), + // ManagedIdentity: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // 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), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// 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() { +// Generated from example definition: 2021-10-01/NSPForActionGroups_Get.json +func ExampleActionGroupsClient_GetNSP() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + res, err := clientFactory.NewActionGroupsClient().GetNSP(ctx, "exampleRG", "someActionGroup", "somePerimeterConfiguration", 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"), + // res = armmonitor.ActionGroupsClientGetNSPResponse{ + // NetworkSecurityPerimeterConfiguration: armmonitor.NetworkSecurityPerimeterConfiguration{ + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/actionGroups/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/actionGroups/someActionGroup/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, // }, - // { - // 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 +// Generated from example definition: 2024-10-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -685,107 +795,110 @@ func ExampleActionGroupsClient_GetTestNotificationsAtActionGroupResourceLevel() // 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"), + // res = armmonitor.ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse{ + // 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"), + // }, // }, - // { - // 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"), + // 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"), // }, - // { - // 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"), // }, - // 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() { +// Generated from example definition: 2024-10-01-preview/listActionGroupsByResourceGroup.json +func ExampleActionGroupsClient_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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewActionGroupsClient().NewListBySubscriptionIDPager(nil) + pager := clientFactory.NewActionGroupsClient().NewListByResourceGroupPager("Default-NotificationRules", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -796,140 +909,516 @@ func ExampleActionGroupsClient_NewListBySubscriptionIDPager() { _ = 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{ + // page = armmonitor.ActionGroupsClientListByResourceGroupResponse{ + // 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"), + // Identity: &armmonitor.ManagedServiceIdentity{ + // Type: to.Ptr(armmonitor.ManagedServiceIdentityType("UserAssigned, SystemAssigned")), + // PrincipalID: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserAssignedIdentity{ + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("73525f7b-16f5-439f-b150-e6f737b8cb16"), + // PrincipalID: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // }, + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("4dfa770d-290d-465b-ad06-4a787b65c641"), + // PrincipalID: to.Ptr("92b72e3e-dc08-4697-8643-32426387ebce"), + // }, + // }, // }, - // 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{ + // Location: to.Ptr("Global"), + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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"), + // ManagedIdentity: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + // 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), + // }, + // }, // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ + // Tags: map[string]*string{ // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ + // }, + // { + // 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"), + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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{ + // }, // }, - // 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{ + // Tags: map[string]*string{ // }, - // 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{ + // }, + // } + } +} + +// Generated from example definition: 2024-10-01-preview/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("187f412d-1758-44d9-b052-169e2564721d", 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 = armmonitor.ActionGroupsClientListBySubscriptionIDResponse{ + // 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"), + // Identity: &armmonitor.ManagedServiceIdentity{ + // Type: to.Ptr(armmonitor.ManagedServiceIdentityType("UserAssigned, SystemAssigned")), + // PrincipalID: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserAssignedIdentity{ + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("73525f7b-16f5-439f-b150-e6f737b8cb16"), + // PrincipalID: to.Ptr("30fe7a91-cd31-4edf-96ab-52883b3199cd"), + // }, + // "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": &armmonitor.UserAssignedIdentity{ + // ClientID: to.Ptr("4dfa770d-290d-465b-ad06-4a787b65c641"), + // PrincipalID: to.Ptr("92b72e3e-dc08-4697-8643-32426387ebce"), + // }, + // }, // }, - // 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{ + // Location: to.Ptr("Global"), + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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"), + // ManagedIdentity: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + // 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), + // }, + // }, // }, - // GroupShortName: to.Ptr("sample2"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ + // Tags: map[string]*string{ // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ + // }, + // { + // 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"), + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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{ + // }, // }, - // 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{ + // Tags: map[string]*string{ // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2021-10-01/NSPForActionGroups_List.json +func ExampleActionGroupsClient_NewListNSPPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewActionGroupsClient().NewListNSPPager("exampleRG", "someActionGroup", 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 = armmonitor.ActionGroupsClientListNSPResponse{ + // NetworkSecurityPerimeterConfigurationListResult: armmonitor.NetworkSecurityPerimeterConfigurationListResult{ + // Value: []*armmonitor.NetworkSecurityPerimeterConfiguration{ + // { + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/actionGroups/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/actionGroups/someActionGroup/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, // }, // }, - // }}, + // }, + // }, // } } } -// 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() { +// Generated from example definition: 2021-10-01/NSPForActionGroups_Reconcile.json +func ExampleActionGroupsClient_BeginReconcileNSP() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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"), + poller, err := clientFactory.NewActionGroupsClient().BeginReconcileNSP(ctx, "exampleRG", "someActionGroup", "somePerimeterConfiguration", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2024-10-01-preview/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("187f412d-1758-44d9-b052-169e2564721d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewActionGroupsClient().Update(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupPatchBody{ + Identity: &armmonitor.ManagedServiceIdentity{ + Type: to.Ptr(armmonitor.ManagedServiceIdentityTypeSystemAssigned), + }, + 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 = armmonitor.ActionGroupsClientUpdateResponse{ + // 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"), + // Identity: &armmonitor.ManagedServiceIdentity{ + // Type: to.Ptr(armmonitor.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("f11979a4-36d1-45d0-9097-a0da3c7e855d"), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // }, + // Location: to.Ptr("Global"), + // 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"), + // IncidentReceivers: []*armmonitor.IncidentReceiver{ + // }, + // 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), + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go index 27119f49f17b..f82a25685c1e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // ActivityLogAlertsClient contains the methods for the ActivityLogAlerts group. // Don't use this type directly, use NewActivityLogAlertsClient() instead. +// +// Generated from API version 2023-01-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCr // 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. @@ -72,8 +71,8 @@ func (client *ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resou } // 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}" +func (client *ActivityLogAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, _ *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") } @@ -91,9 +90,10 @@ func (client *ActivityLogAlertsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, activityLogAlertRule); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *ActivityLogAlertsClient) createOrUpdateHandleResponse(resp *http.R // 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 @@ -139,8 +137,8 @@ func (client *ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroup } // 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}" +func (client *ActivityLogAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, _ *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") } @@ -158,16 +156,13 @@ func (client *ActivityLogAlertsClient) deleteCreateRequest(ctx context.Context, 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"} + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. @@ -194,8 +189,8 @@ func (client *ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupNam } // 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}" +func (client *ActivityLogAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, _ *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") } @@ -213,8 +208,8 @@ func (client *ActivityLogAlertsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -229,8 +224,6 @@ func (client *ActivityLogAlertsClient) getHandleResponse(resp *http.Response) (A } // 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. @@ -258,8 +251,8 @@ func (client *ActivityLogAlertsClient) NewListByResourceGroupPager(resourceGroup } // 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" +func (client *ActivityLogAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") } @@ -273,8 +266,8 @@ func (client *ActivityLogAlertsClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -289,8 +282,6 @@ func (client *ActivityLogAlertsClient) listByResourceGroupHandleResponse(resp *h } // 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] { @@ -317,7 +308,7 @@ func (client *ActivityLogAlertsClient) NewListBySubscriptionIDPager(options *Act } // listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. -func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *ActivityLogAlertsClientListBySubscriptionIDOptions) (*policy.Request, error) { +func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx context.Context, _ *ActivityLogAlertsClientListBySubscriptionIDOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -328,8 +319,8 @@ func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -344,11 +335,8 @@ func (client *ActivityLogAlertsClient) listBySubscriptionIDHandleResponse(resp * } // 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. +// 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. @@ -377,8 +365,8 @@ func (client *ActivityLogAlertsClient) Update(ctx context.Context, resourceGroup } // 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}" +func (client *ActivityLogAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, _ *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") } @@ -396,9 +384,10 @@ func (client *ActivityLogAlertsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, activityLogAlertRulePatch); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go index 04f3c6e85363..4d443481c5f6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go @@ -1,44 +1,44 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", 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{ + ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ { ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + ActionProperties: map[string]*string{ + "Email.Title": to.Ptr("my email title"), + }, WebhookProperties: map[string]*string{ "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), }, - }}, + }, + }, }, Condition: &armmonitor.AlertRuleAllOfCondition{ AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ @@ -49,12 +49,15 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl { Equals: to.Ptr("Error"), Field: to.Ptr("level"), - }}, + }, + }, }, Enabled: to.Ptr(true), Scopes: []*string{ - to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d"), + }, }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -62,66 +65,77 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl // 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"), + // res = armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), // }, - // }}, - // }, - // 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"), + // }, // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, - // } + // }, + // } } -// 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 +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", 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{ + ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ { ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + ActionProperties: map[string]*string{ + "Email.Title": to.Ptr("my email title"), + }, WebhookProperties: map[string]*string{ "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), }, - }}, + }, + }, }, Condition: &armmonitor.AlertRuleAllOfCondition{ AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ @@ -138,13 +152,17 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl { Equals: to.Ptr("Maintenance"), Field: to.Ptr("properties.incidentType"), - }}, - }}, + }, + }, + }, + }, }, Enabled: to.Ptr(true), Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d"), + }, }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -152,73 +170,85 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl // 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"), + // res = armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), + // }, + // 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"), + // }, // }, - // { - // Equals: to.Ptr("Maintenance"), - // Field: to.Ptr("properties.incidentType"), - // }}, - // }}, + // }, + // }, + // }, + // Enabled: to.Ptr(true), + // Scopes: []*string{ + // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d"), + // }, // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, - // } + // }, + // } } -// 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 +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", 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{ + ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ { ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + ActionProperties: map[string]*string{ + "Email.Title": to.Ptr("my email title"), + }, WebhookProperties: map[string]*string{ "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), }, - }}, + }, + }, }, Condition: &armmonitor.AlertRuleAllOfCondition{ AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ @@ -229,14 +259,18 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl { ContainsAny: []*string{ to.Ptr("North Europe"), - to.Ptr("West 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")}, + to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d"), + }, }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -244,191 +278,234 @@ func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAl // 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"), + // res = armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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")}, + // }, + // 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")}, + // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d"), // }, - // } + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2023-01-01-preview/ActivityLogAlertRule_CreateOrUpdateTenantLevelServiceHealthRule.json +func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleForTenantLevelEvents() { 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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewActivityLogAlertsClient().Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) + res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertSHRuleOnTenantLevel", armmonitor.ActivityLogAlertResource{ + Location: to.Ptr("Global"), + Properties: &armmonitor.AlertRuleProperties{ + Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), + Actions: &armmonitor.ActionList{ + ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + { + ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), + ActionProperties: map[string]*string{ + "Email.Title": to.Ptr("my email title"), + }, + WebhookProperties: map[string]*string{ + "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), + }, + }, + }, + }, + Condition: &armmonitor.AlertRuleAllOfCondition{ + AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ + { + Equals: to.Ptr("ServiceHealth"), + Field: to.Ptr("category"), + }, + }, + }, + Enabled: to.Ptr(true), + TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + }, + 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.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"), + // res = armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse{ + // ActivityLogAlertResource: armmonitor.ActivityLogAlertResource{ + // Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"), + // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), + // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"), + // Location: to.Ptr("Global"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // WebhookProperties: map[string]*string{ + // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), + // }, + // }, + // }, + // }, + // Condition: &armmonitor.AlertRuleAllOfCondition{ + // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ + // { + // Equals: to.Ptr("ServiceHealth"), + // Field: to.Ptr("category"), // }, - // }}, - // }, - // 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), + // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, - // } + // }, + // } } -// 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 +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewActivityLogAlertsClient().Delete(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) + res, err := clientFactory.NewActivityLogAlertsClient().Delete(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 = armmonitor.ActivityLogAlertsClientDeleteResponse{ + // } } -// 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() { +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", 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) + 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{ - // "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"), + // res = armmonitor.ActivityLogAlertsClientGetResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), - // }}, + // }, + // 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"), + // }, // }, - // Enabled: to.Ptr(false), - // Scopes: []*string{ - // to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, - // } + // }, + // } } -// 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() { +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(nil) + pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -439,58 +516,67 @@ func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { _ = 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"), + // page = armmonitor.ActivityLogAlertsClientListByResourceGroupResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), - // }}, + // }, + // 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"), + // }, // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, // }, // { // 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"), + // 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{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, // WebhookProperties: map[string]*string{ // }, - // }}, + // }, + // }, // }, // Condition: &armmonitor.AlertRuleAllOfCondition{ // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ @@ -501,29 +587,35 @@ func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { // { // Equals: to.Ptr("Succeeded"), // Field: to.Ptr("status"), - // }}, + // }, + // }, // }, // Enabled: to.Ptr(true), // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2")}, + // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup"), // }, - // }}, - // } + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } } } -// 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() { +// Generated from example definition: 2023-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("187f412d-1758-44d9-b052-169e2564721d", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", nil) + pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -534,58 +626,67 @@ func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { _ = 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"), + // page = armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), // }, - // }}, - // }, - // 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"), + // }, // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, + // Tags: map[string]*string{ // }, // }, // { // 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"), + // 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{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, // WebhookProperties: map[string]*string{ // }, - // }}, + // }, + // }, // }, // Condition: &armmonitor.AlertRuleAllOfCondition{ // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ @@ -596,13 +697,91 @@ func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { // { // Equals: to.Ptr("Succeeded"), // Field: to.Ptr("status"), - // }}, + // }, + // }, // }, // Enabled: to.Ptr(true), // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup")}, + // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2"), // }, - // }}, - // } + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2023-01-01-preview/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("187f412d-1758-44d9-b052-169e2564721d", 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 = armmonitor.ActivityLogAlertsClientUpdateResponse{ + // 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"), + // Properties: &armmonitor.AlertRuleProperties{ + // Description: to.Ptr("Description of sample Activity Log Alert rule."), + // Actions: &armmonitor.ActionList{ + // ActionGroups: []*armmonitor.ActivityLogAlertActionGroup{ + // { + // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), + // ActionProperties: map[string]*string{ + // "Email.Title": to.Ptr("my email title"), + // }, + // 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"), + // }, + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go index 1f6470942a69..f18ede974342 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // ActivityLogsClient contains the methods for the ActivityLogs group. // Don't use this type directly, use NewActivityLogsClient() instead. +// +// Generated from API version 2015-04-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,22 +42,16 @@ func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredent } // 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. +// - 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]{ @@ -93,12 +88,12 @@ func (client *ActivityLogsClient) listCreateRequest(ctx context.Context, filter 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() + reqQP.Set("api-version", version20150401) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go index 3197dece0a98..ddbdf95b06dd 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go @@ -1,32 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2015-04-01/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) + clientFactory, err := armmonitor.NewClientFactory("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", 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}) + pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -37,93 +34,98 @@ func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilter() { _ = 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"), + // page = armmonitor.ActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), + // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), // }, - // 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 +// Generated from example definition: 2015-04-01/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) + clientFactory, err := armmonitor.NewClientFactory("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", 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")}) + 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 { @@ -134,32 +136,36 @@ func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilterAndSelect() _ = 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"), + // page = armmonitor.ActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), // }, - // 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 index 8340be9c8951..6ff131bc3797 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // AlertRuleIncidentsClient contains the methods for the AlertRuleIncidents group. // Don't use this type directly, use NewAlertRuleIncidentsClient() instead. +// +// Generated from API version 2016-03-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenC // 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. @@ -71,8 +70,12 @@ func (client *AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (*policy.Request, error) { +func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, _ *AlertRuleIncidentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}" + 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") } @@ -85,17 +88,13 @@ func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, re 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() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -110,8 +109,6 @@ func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) ( } // 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 @@ -119,21 +116,20 @@ func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) ( 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByAlertRuleCreateRequest(ctx, resourceGroupName, ruleName, options) + }, nil) 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(), @@ -141,8 +137,12 @@ func (client *AlertRuleIncidentsClient) NewListByAlertRulePager(resourceGroupNam } // 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" +func (client *AlertRuleIncidentsClient) listByAlertRuleCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *AlertRuleIncidentsClientListByAlertRuleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}/incidents" + 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") } @@ -151,17 +151,13 @@ func (client *AlertRuleIncidentsClient) listByAlertRuleCreateRequest(ctx context 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() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go index 61d1e7bd873c..09ef8e229974 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,23 +29,25 @@ func ExampleAlertRuleIncidentsClient_Get() { // 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"), + // res = armmonitor.AlertRuleIncidentsClientGetResponse{ + // Incident: armmonitor.Incident{ + // Name: to.Ptr("Website_started"), + // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.9792776Z"); return t}()), + // IsActive: to.Ptr(true), + // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.9792776Z"); 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 +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -63,15 +62,18 @@ func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() { _ = 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"), - // }}, + // page = armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse{ + // 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.9792776Z"); return t}()), + // IsActive: to.Ptr(true), + // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.9792776Z"); 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 0ad09af4a3d4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 27debd50b00e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 deleted file mode 100644 index 1a2805b6b7e6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ /dev/null @@ -1,12 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` 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 -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.11.0 -``` diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go index 4d9ba2d5c00d..3c7c95827e56 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // AutoscaleSettingsClient contains the methods for the AutoscaleSettings group. // Don't use this type directly, use NewAutoscaleSettingsClient() instead. +// +// Generated from API version 2022-10-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCr // 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. @@ -72,8 +71,12 @@ func (client *AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, _ *AutoscaleSettingsClientCreateOrUpdateOptions) (*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") } @@ -82,18 +85,15 @@ func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.C 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() + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *AutoscaleSettingsClient) createOrUpdateHandleResponse(resp *http.R // 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 @@ -139,8 +137,12 @@ func (client *AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, _ *AutoscaleSettingsClientDeleteOptions) (*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") } @@ -149,25 +151,18 @@ func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, 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"} + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. @@ -194,8 +189,12 @@ func (client *AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupNam } // getCreateRequest creates the Get request. -func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, _ *AutoscaleSettingsClientGetOptions) (*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") } @@ -204,17 +203,13 @@ func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, res 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() + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -229,8 +224,6 @@ func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (A } // 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. @@ -258,23 +251,23 @@ func (client *AutoscaleSettingsClient) NewListByResourceGroupPager(resourceGroup } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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)) + 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-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -289,8 +282,6 @@ func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *h } // 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] { @@ -317,7 +308,7 @@ func (client *AutoscaleSettingsClient) NewListBySubscriptionPager(options *Autos } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AutoscaleSettingsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AutoscaleSettingsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -328,8 +319,8 @@ func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -345,8 +336,6 @@ func (client *AutoscaleSettingsClient) listBySubscriptionHandleResponse(resp *ht // 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. @@ -375,7 +364,7 @@ func (client *AutoscaleSettingsClient) Update(ctx context.Context, resourceGroup } // updateCreateRequest creates the Update request. -func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (*policy.Request, error) { +func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, _ *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") @@ -394,9 +383,10 @@ func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20221001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, autoscaleSettingResource); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go index 992933aeb8e8..b1d66f53fbfe 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go @@ -1,214 +1,31 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" + "time" ) -// 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 +// Generated from example definition: 2022-10-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", 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{ @@ -216,7 +33,8 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { Email: &armmonitor.EmailNotification{ CustomEmails: []*string{ to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, + to.Ptr("ge@ns.net"), + }, SendToSubscriptionAdministrator: to.Ptr(true), SendToSubscriptionCoAdministrators: to.Ptr(true), }, @@ -225,8 +43,10 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { { Properties: map[string]*string{}, ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, + }, + }, + }, + }, PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), }, @@ -239,8 +59,8 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { 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 }()), + End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00Z"); return t }()), + Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); return t }()), TimeZone: to.Ptr("UTC"), }, Rules: []*armmonitor.ScaleRule{ @@ -281,7 +101,8 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), Value: to.Ptr("2"), }, - }}, + }, + }, }, { Name: to.Ptr("saludos"), @@ -294,11 +115,14 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), Schedule: &armmonitor.RecurrentSchedule{ Days: []*string{ - to.Ptr("1")}, + to.Ptr("1"), + }, Hours: []*int32{ - to.Ptr[int32](5)}, + to.Ptr[int32](5), + }, Minutes: []*int32{ - to.Ptr[int32](15)}, + to.Ptr[int32](15), + }, TimeZone: to.Ptr("UTC"), }, }, @@ -340,10 +164,16 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { 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"), + "key2": to.Ptr("value2"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -351,24 +181,22 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { // 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{ + // res = armmonitor.AutoscaleSettingsClientCreateOrUpdateResponse{ + // AutoscaleSettingResource: armmonitor.AutoscaleSettingResource{ // 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")}, + // 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"), + // 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), // }, @@ -378,8 +206,10 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { // Properties: map[string]*string{ // }, // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, + // }, + // }, + // }, + // }, // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), // }, @@ -392,8 +222,8 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { // 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}()), + // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00Z"); return t}()), + // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); return t}()), // TimeZone: to.Ptr("UTC"), // }, // Rules: []*armmonitor.ScaleRule{ @@ -434,7 +264,8 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), // Value: to.Ptr("2"), // }, - // }}, + // }, + // }, // }, // { // Name: to.Ptr("saludos"), @@ -447,84 +278,99 @@ func ExampleAutoscaleSettingsClient_CreateOrUpdate() { // 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"), + // 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"), + // "key2": to.Ptr("value2"), + // }, + // }, + // } } -// 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 +// Generated from example definition: 2022-10-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewAutoscaleSettingsClient().Delete(ctx, "TestingMetricsScaleSet", "MySetting", nil) + res, err := clientFactory.NewAutoscaleSettingsClient().Delete(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 = armmonitor.AutoscaleSettingsClientDeleteResponse{ + // } } -// 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 +// Generated from example definition: 2022-10-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -535,23 +381,22 @@ func ExampleAutoscaleSettingsClient_Get() { // 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{ + // res = armmonitor.AutoscaleSettingsClientGetResponse{ + // AutoscaleSettingResource: armmonitor.AutoscaleSettingResource{ // 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")}, + // 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"), + // 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), // }, @@ -561,8 +406,10 @@ func ExampleAutoscaleSettingsClient_Get() { // Properties: map[string]*string{ // }, // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, + // }, + // }, + // }, + // }, // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), // }, @@ -575,8 +422,8 @@ func ExampleAutoscaleSettingsClient_Get() { // 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}()), + // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00Z"); return t}()), + // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); return t}()), // TimeZone: to.Ptr("UTC"), // }, // Rules: []*armmonitor.ScaleRule{ @@ -617,7 +464,8 @@ func ExampleAutoscaleSettingsClient_Get() { // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), // Value: to.Ptr("2"), // }, - // }}, + // }, + // }, // }, // { // Name: to.Ptr("saludos"), @@ -630,89 +478,476 @@ func ExampleAutoscaleSettingsClient_Get() { // 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"), + // 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"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2022-10-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", 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"), + 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 = armmonitor.AutoscaleSettingsClientListByResourceGroupResponse{ + // AutoscaleSettingResourceCollection: armmonitor.AutoscaleSettingResourceCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings?$skiptoken=opaqueSkipToken"), + // 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"), + // 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:00Z"); return t}()), + // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); 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"), + // "key2": to.Ptr("value2"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2022-10-01/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("b67f7fec-69fc-4974-9099-a26bd6ffeda3", 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 = armmonitor.AutoscaleSettingsClientListBySubscriptionResponse{ + // AutoscaleSettingResourceCollection: armmonitor.AutoscaleSettingResourceCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/providers/microsoft.insights/autoscalesettings?$skiptoken=opaqueSkipToken"), + // 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"), + // 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:00Z"); return t}()), + // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); 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"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2022-10-01/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("b67f7fec-69fc-4974-9099-a26bd6ffeda3", 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), }, @@ -725,8 +960,8 @@ func ExampleAutoscaleSettingsClient_Update() { 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 }()), + End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00Z"); return t }()), + Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); return t }()), TimeZone: to.Ptr("UTC"), }, Rules: []*armmonitor.ScaleRule{ @@ -767,7 +1002,8 @@ func ExampleAutoscaleSettingsClient_Update() { Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), Value: to.Ptr("2"), }, - }}, + }, + }, }, { Name: to.Ptr("saludos"), @@ -780,11 +1016,14 @@ func ExampleAutoscaleSettingsClient_Update() { Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), Schedule: &armmonitor.RecurrentSchedule{ Days: []*string{ - to.Ptr("1")}, + to.Ptr("1"), + }, Hours: []*int32{ - to.Ptr[int32](5)}, + to.Ptr[int32](5), + }, Minutes: []*int32{ - to.Ptr[int32](15)}, + to.Ptr[int32](15), + }, TimeZone: to.Ptr("UTC"), }, }, @@ -826,8 +1065,10 @@ func ExampleAutoscaleSettingsClient_Update() { 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{ @@ -840,23 +1081,22 @@ func ExampleAutoscaleSettingsClient_Update() { // 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{ + // res = armmonitor.AutoscaleSettingsClientUpdateResponse{ + // AutoscaleSettingResource: armmonitor.AutoscaleSettingResource{ // 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")}, + // 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"), + // 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), // }, @@ -866,8 +1106,10 @@ func ExampleAutoscaleSettingsClient_Update() { // Properties: map[string]*string{ // }, // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, + // }, + // }, + // }, + // }, // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), // }, @@ -880,8 +1122,8 @@ func ExampleAutoscaleSettingsClient_Update() { // 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}()), + // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00Z"); return t}()), + // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00Z"); return t}()), // TimeZone: to.Ptr("UTC"), // }, // Rules: []*armmonitor.ScaleRule{ @@ -922,7 +1164,8 @@ func ExampleAutoscaleSettingsClient_Update() { // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), // Value: to.Ptr("2"), // }, - // }}, + // }, + // }, // }, // { // Name: to.Ptr("saludos"), @@ -935,229 +1178,64 @@ func ExampleAutoscaleSettingsClient_Update() { // 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"), + // to.Ptr("1"), + // }, + // Hours: []*int32{ + // to.Ptr[int32](5), + // }, + // Minutes: []*int32{ + // to.Ptr[int32](15), + // }, + // TimeZone: to.Ptr("UTC"), + // }, // }, - // } -} - -// 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"), - // }, - // }}, - // } - } + // 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{ + // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go deleted file mode 100644 index 1cd87af23b26..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 9ba6a44148d0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 index 0fd582a9c0d4..a62abf085977 100644 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" @@ -17,13 +17,15 @@ import ( // BaselinesClient contains the methods for the Baselines group. // Don't use this type directly, use NewBaselinesClient() instead. +// +// Generated from API version 2019-03-01 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. +// - options - Contains optional client configuration. 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 { @@ -35,29 +37,26 @@ func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOp 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. +// NewListPager - **Lists the metric baseline values for a resource**. +// - resourceURI - The fully qualified Azure Resource manager 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceURI, options) + }, nil) 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(), @@ -67,38 +66,41 @@ func (client *BaselinesClient) NewListPager(resourceURI string, options *Baselin // 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" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } 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.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + reqQP.Set("api-version", version20190301) + 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.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.ResultType != nil { + reqQP.Set("resultType", string(*options.ResultType)) } 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)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - reqQP.Set("api-version", "2019-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go index 12f46737b3fb..6dc0ebb1f1d2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go @@ -1,40 +1,33 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2019-03-01/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) + 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, - }) + pager := clientFactory.NewBaselinesClient().NewListPager("subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", &armmonitor.BaselinesClientListOptions{ + Aggregation: to.Ptr("average"), + Interval: to.Ptr("PT1H"), + Sensitivities: to.Ptr("Low,Medium"), + Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -45,55 +38,66 @@ func ExampleBaselinesClient_NewListPager() { _ = 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)}, + // page = armmonitor.BaselinesClientListResponse{ + // 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), + // 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), // }, - // { - // 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"), + // 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/build.go b/sdk/resourcemanager/monitor/armmonitor/build.go deleted file mode 100644 index ac027408772d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/monitor/armmonitor - -package armmonitor diff --git a/sdk/resourcemanager/monitor/armmonitor/client_factory.go b/sdk/resourcemanager/monitor/armmonitor/client_factory.go index c2a5a0426952..77184ee66685 100644 --- a/sdk/resourcemanager/monitor/armmonitor/client_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/client_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -14,214 +13,224 @@ 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. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - 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 + return &ActionGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient. func (c *ClientFactory) NewActivityLogAlertsClient() *ActivityLogAlertsClient { - subClient, _ := NewActivityLogAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActivityLogAlertsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewActivityLogsClient creates a new instance of ActivityLogsClient. func (c *ClientFactory) NewActivityLogsClient() *ActivityLogsClient { - subClient, _ := NewActivityLogsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActivityLogsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // 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 + return &AlertRuleIncidentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // 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 + return &AutoscaleSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewBaselinesClient creates a new instance of BaselinesClient. func (c *ClientFactory) NewBaselinesClient() *BaselinesClient { - subClient, _ := NewBaselinesClient(c.credential, c.options) - return subClient + return &BaselinesClient{ + internal: c.internal, + } } // NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient. func (c *ClientFactory) NewDataCollectionEndpointsClient() *DataCollectionEndpointsClient { - subClient, _ := NewDataCollectionEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataCollectionEndpointsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient. func (c *ClientFactory) NewDataCollectionRuleAssociationsClient() *DataCollectionRuleAssociationsClient { - subClient, _ := NewDataCollectionRuleAssociationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataCollectionRuleAssociationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // 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 + return &DataCollectionRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEventCategoriesClient creates a new instance of EventCategoriesClient. func (c *ClientFactory) NewEventCategoriesClient() *EventCategoriesClient { - subClient, _ := NewEventCategoriesClient(c.credential, c.options) - return subClient + return &EventCategoriesClient{ + internal: c.internal, + } } // NewLogProfilesClient creates a new instance of LogProfilesClient. func (c *ClientFactory) NewLogProfilesClient() *LogProfilesClient { - subClient, _ := NewLogProfilesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &LogProfilesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricAlertsClient creates a new instance of MetricAlertsClient. func (c *ClientFactory) NewMetricAlertsClient() *MetricAlertsClient { - subClient, _ := NewMetricAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricAlertsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient. func (c *ClientFactory) NewMetricAlertsStatusClient() *MetricAlertsStatusClient { - subClient, _ := NewMetricAlertsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricAlertsStatusClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient. func (c *ClientFactory) NewMetricDefinitionsClient() *MetricDefinitionsClient { - subClient, _ := NewMetricDefinitionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MetricDefinitionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMetricNamespacesClient creates a new instance of MetricNamespacesClient. func (c *ClientFactory) NewMetricNamespacesClient() *MetricNamespacesClient { - subClient, _ := NewMetricNamespacesClient(c.credential, c.options) - return subClient + return &MetricNamespacesClient{ + internal: c.internal, + } } // 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 + return &MetricsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPredictiveMetricClient creates a new instance of PredictiveMetricClient. func (c *ClientFactory) NewPredictiveMetricClient() *PredictiveMetricClient { - subClient, _ := NewPredictiveMetricClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PredictiveMetricClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient. func (c *ClientFactory) NewPrivateLinkScopeOperationStatusClient() *PrivateLinkScopeOperationStatusClient { - subClient, _ := NewPrivateLinkScopeOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopeOperationStatusClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient. func (c *ClientFactory) NewPrivateLinkScopedResourcesClient() *PrivateLinkScopedResourcesClient { - subClient, _ := NewPrivateLinkScopedResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopedResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient. func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { - subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkScopesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewScheduledQueryRuleClient creates a new instance of ScheduledQueryRuleClient. +func (c *ClientFactory) NewScheduledQueryRuleClient() *ScheduledQueryRuleClient { + return &ScheduledQueryRuleClient{ + 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 + return &ScheduledQueryRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient. -func (c *ClientFactory) NewTenantActionGroupsClient() *TenantActionGroupsClient { - subClient, _ := NewTenantActionGroupsClient(c.credential, c.options) - return subClient +// NewServiceDiagnosticSettingsClient creates a new instance of ServiceDiagnosticSettingsClient. +func (c *ClientFactory) NewServiceDiagnosticSettingsClient() *ServiceDiagnosticSettingsClient { + return &ServiceDiagnosticSettingsClient{ + internal: c.internal, + } } // 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 &TenantActivityLogsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 4d3975c94441..9fbbf2932565 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -1,20 +1,32 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - moduleVersion = "v0.11.0" + version20150401 string = "2015-04-01" + version20160301 string = "2016-03-01" + version20160901 string = "2016-09-01" + version20190301 string = "2019-03-01" + version20211001 string = "2021-10-01" + version20221001 string = "2022-10-01" + version20230101Preview string = "2023-01-01-preview" + version20230601Preview string = "2023-06-01-preview" + version20240201 string = "2024-02-01" + version20240301Preview string = "2024-03-01-preview" + version20240311 string = "2024-03-11" + version20241001Preview string = "2024-10-01-preview" + version20250101Preview string = "2025-01-01-preview" ) // AccessMode - Access mode types. type AccessMode string const ( - AccessModeOpen AccessMode = "Open" + // AccessModeOpen - Open + AccessModeOpen AccessMode = "Open" + // AccessModePrivateOnly - PrivateOnly AccessModePrivateOnly AccessMode = "PrivateOnly" ) @@ -26,30 +38,40 @@ func PossibleAccessModeValues() []AccessMode { } } -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string +// AccessRuleDirection - Direction of Access Rule +type AccessRuleDirection string const ( - ActionTypeInternal ActionType = "Internal" + // AccessRuleDirectionInbound - Applies to inbound network traffic to the secured resources. + AccessRuleDirectionInbound AccessRuleDirection = "Inbound" + // AccessRuleDirectionOutbound - Applies to outbound network traffic from the secured resources + AccessRuleDirectionOutbound AccessRuleDirection = "Outbound" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, +// PossibleAccessRuleDirectionValues returns the possible values for the AccessRuleDirection const type. +func PossibleAccessRuleDirectionValues() []AccessRuleDirection { + return []AccessRuleDirection{ + AccessRuleDirectionInbound, + AccessRuleDirectionOutbound, } } -// AggregationType - the aggregation type of the metric. +// AggregationType - The aggregation type of the metric. type AggregationType string const ( + // AggregationTypeAverage - Average AggregationTypeAverage AggregationType = "Average" - AggregationTypeCount AggregationType = "Count" + // AggregationTypeCount - Count + AggregationTypeCount AggregationType = "Count" + // AggregationTypeMaximum - Maximum AggregationTypeMaximum AggregationType = "Maximum" + // AggregationTypeMinimum - Minimum AggregationTypeMinimum AggregationType = "Minimum" - AggregationTypeNone AggregationType = "None" - AggregationTypeTotal AggregationType = "Total" + // AggregationTypeNone - None + AggregationTypeNone AggregationType = "None" + // AggregationTypeTotal - Total + AggregationTypeTotal AggregationType = "Total" ) // PossibleAggregationTypeValues returns the possible values for the AggregationType const type. @@ -64,15 +86,20 @@ func PossibleAggregationTypeValues() []AggregationType { } } -// AggregationTypeEnum - the criteria time aggregation types. +// AggregationTypeEnum - The criteria time aggregation types. Previously undocumented values might be returned type AggregationTypeEnum string const ( + // AggregationTypeEnumAverage - Average AggregationTypeEnumAverage AggregationTypeEnum = "Average" - AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumCount - Count + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum - Maximum AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum - Minimum AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - AggregationTypeEnumTotal AggregationTypeEnum = "Total" + // AggregationTypeEnumTotal - Total + AggregationTypeEnumTotal AggregationTypeEnum = "Total" ) // PossibleAggregationTypeEnumValues returns the possible values for the AggregationTypeEnum const type. @@ -91,11 +118,16 @@ func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { type AlertSeverity int64 const ( - AlertSeverityFour AlertSeverity = 4 - AlertSeverityOne AlertSeverity = 1 + // AlertSeverityFour - 4 + AlertSeverityFour AlertSeverity = 4 + // AlertSeverityOne - 1 + AlertSeverityOne AlertSeverity = 1 + // AlertSeverityThree - 3 AlertSeverityThree AlertSeverity = 3 - AlertSeverityTwo AlertSeverity = 2 - AlertSeverityZero AlertSeverity = 0 + // AlertSeverityTwo - 2 + AlertSeverityTwo AlertSeverity = 2 + // AlertSeverityZero - 0 + AlertSeverityZero AlertSeverity = 0 ) // PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type. @@ -113,8 +145,11 @@ func PossibleAlertSeverityValues() []AlertSeverity { type BaselineSensitivity string const ( - BaselineSensitivityHigh BaselineSensitivity = "High" - BaselineSensitivityLow BaselineSensitivity = "Low" + // BaselineSensitivityHigh - High + BaselineSensitivityHigh BaselineSensitivity = "High" + // BaselineSensitivityLow - Low + BaselineSensitivityLow BaselineSensitivity = "Low" + // BaselineSensitivityMedium - Medium BaselineSensitivityMedium BaselineSensitivity = "Medium" ) @@ -127,32 +162,22 @@ func PossibleBaselineSensitivityValues() []BaselineSensitivity { } } -// 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" + // ComparisonOperationTypeEquals - Equals + ComparisonOperationTypeEquals ComparisonOperationType = "Equals" + // ComparisonOperationTypeGreaterThan - GreaterThan + ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" + // ComparisonOperationTypeGreaterThanOrEqual - GreaterThanOrEqual ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" + // ComparisonOperationTypeLessThan - LessThan + ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" + // ComparisonOperationTypeLessThanOrEqual - LessThanOrEqual + ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // ComparisonOperationTypeNotEquals - NotEquals + ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" ) // PossibleComparisonOperationTypeValues returns the possible values for the ComparisonOperationType const type. @@ -167,21 +192,29 @@ func PossibleComparisonOperationTypeValues() []ComparisonOperationType { } } -// 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" - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorEquals - Equals + ConditionOperatorEquals ConditionOperator = "Equals" + // ConditionOperatorGreaterOrLessThan - GreaterOrLessThan + ConditionOperatorGreaterOrLessThan ConditionOperator = "GreaterOrLessThan" + // ConditionOperatorGreaterThan - GreaterThan + ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorGreaterThanOrEqual - GreaterThanOrEqual ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - ConditionOperatorLessThan ConditionOperator = "LessThan" - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" + // ConditionOperatorLessThan - LessThan + ConditionOperatorLessThan ConditionOperator = "LessThan" + // ConditionOperatorLessThanOrEqual - LessThanOrEqual + ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" ) // PossibleConditionOperatorValues returns the possible values for the ConditionOperator const type. func PossibleConditionOperatorValues() []ConditionOperator { return []ConditionOperator{ ConditionOperatorEquals, + ConditionOperatorGreaterOrLessThan, ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, @@ -189,14 +222,18 @@ func PossibleConditionOperatorValues() []ConditionOperator { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -209,12 +246,14 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// CriterionType - Specifies the type of threshold criteria +// CriterionType - Specifies the type of threshold criteria. Previously undocumented values might be returned type CriterionType string const ( + // CriterionTypeDynamicThresholdCriterion - DynamicThresholdCriterion CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" + // CriterionTypeStaticThresholdCriterion - StaticThresholdCriterion + CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" ) // PossibleCriterionTypeValues returns the possible values for the CriterionType const type. @@ -225,28 +264,13 @@ 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 const ( + // DimensionOperatorExclude - Exclude DimensionOperatorExclude DimensionOperator = "Exclude" + // DimensionOperatorInclude - Include DimensionOperatorInclude DimensionOperator = "Include" ) @@ -258,13 +282,17 @@ func PossibleDimensionOperatorValues() []DimensionOperator { } } -// DynamicThresholdOperator - The operator used to compare the metric value against the threshold. +// DynamicThresholdOperator - The operator used to compare the metric value against the threshold. Previously undocumented +// values might be returned type DynamicThresholdOperator string const ( + // DynamicThresholdOperatorGreaterOrLessThan - GreaterOrLessThan DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" + // DynamicThresholdOperatorGreaterThan - GreaterThan + DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" + // DynamicThresholdOperatorLessThan - LessThan + DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" ) // PossibleDynamicThresholdOperatorValues returns the possible values for the DynamicThresholdOperator const type. @@ -277,12 +305,15 @@ func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { } // DynamicThresholdSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold -// is to the metric series pattern. +// is to the metric series pattern. Previously undocumented values might be returned type DynamicThresholdSensitivity string const ( - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityHigh - High + DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" + // DynamicThresholdSensitivityLow - Low + DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityMedium - Medium DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" ) @@ -299,11 +330,16 @@ func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { type EventLevel string const ( - EventLevelCritical EventLevel = "Critical" - EventLevelError EventLevel = "Error" + // EventLevelCritical - Critical + EventLevelCritical EventLevel = "Critical" + // EventLevelError - Error + EventLevelError EventLevel = "Error" + // EventLevelInformational - Informational EventLevelInformational EventLevel = "Informational" - EventLevelVerbose EventLevel = "Verbose" - EventLevelWarning EventLevel = "Warning" + // EventLevelVerbose - Verbose + EventLevelVerbose EventLevel = "Verbose" + // EventLevelWarning - Warning + EventLevelWarning EventLevel = "Warning" ) // PossibleEventLevelValues returns the possible values for the EventLevel const type. @@ -321,9 +357,12 @@ func PossibleEventLevelValues() []EventLevel { type IdentityType string const ( - IdentityTypeNone IdentityType = "None" + // IdentityTypeNone - None + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned - SystemAssigned IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - IdentityTypeUserAssigned IdentityType = "UserAssigned" + // IdentityTypeUserAssigned - UserAssigned + IdentityTypeUserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns the possible values for the IdentityType const type. @@ -335,12 +374,58 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// IncidentManagementService - The incident management service type +type IncidentManagementService string + +const ( + // IncidentManagementServiceIcm - Icm + IncidentManagementServiceIcm IncidentManagementService = "Icm" +) + +// PossibleIncidentManagementServiceValues returns the possible values for the IncidentManagementService const type. +func PossibleIncidentManagementServiceValues() []IncidentManagementService { + return []IncidentManagementService{ + IncidentManagementServiceIcm, + } +} + +// IssueType - Type of issue +type IssueType string + +const ( + // IssueTypeConfigurationPropagationFailure - An error occurred while applying the network security perimeter (NSP) configuration. + IssueTypeConfigurationPropagationFailure IssueType = "ConfigurationPropagationFailure" + // IssueTypeMissingIdentityConfiguration - An managed identity hasn't been associated with the resource. The resource will + // still be able to validate inbound traffic from the network security perimeter (NSP) or matching inbound access rules, but + // it won't be able to perform outbound access as a member of the NSP. + IssueTypeMissingIdentityConfiguration IssueType = "MissingIdentityConfiguration" + // IssueTypeMissingPerimeterConfiguration - A network connectivity issue is happening on the resource which could be addressed + // either by adding new resources to the network security perimeter (NSP) or by modifying access rules. + IssueTypeMissingPerimeterConfiguration IssueType = "MissingPerimeterConfiguration" + // IssueTypeUnknown - Unknown issue type + IssueTypeUnknown IssueType = "Unknown" +) + +// PossibleIssueTypeValues returns the possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{ + IssueTypeConfigurationPropagationFailure, + IssueTypeMissingIdentityConfiguration, + IssueTypeMissingPerimeterConfiguration, + IssueTypeUnknown, + } +} + // Kind - Indicates the type of scheduled query rule. The default is LogAlert. type Kind string const ( - KindLogAlert Kind = "LogAlert" + // KindLogAlert - LogAlert + KindLogAlert Kind = "LogAlert" + // KindLogToMetric - LogToMetric KindLogToMetric Kind = "LogToMetric" + // KindSimpleLogAlert - SimpleLogAlert + KindSimpleLogAlert Kind = "SimpleLogAlert" ) // PossibleKindValues returns the possible values for the Kind const type. @@ -348,6 +433,29 @@ func PossibleKindValues() []Kind { return []Kind{ KindLogAlert, KindLogToMetric, + KindSimpleLogAlert, + } +} + +// KnownAgentSettingName - The name of the setting. +// Must be part of the list of supported settings +type KnownAgentSettingName string + +const ( + // KnownAgentSettingNameMaxDiskQuotaInMB - MaxDiskQuotaInMB + KnownAgentSettingNameMaxDiskQuotaInMB KnownAgentSettingName = "MaxDiskQuotaInMB" + // KnownAgentSettingNameTags - Tags + KnownAgentSettingNameTags KnownAgentSettingName = "Tags" + // KnownAgentSettingNameUseTimeReceivedForForwardedEvents - UseTimeReceivedForForwardedEvents + KnownAgentSettingNameUseTimeReceivedForForwardedEvents KnownAgentSettingName = "UseTimeReceivedForForwardedEvents" +) + +// PossibleKnownAgentSettingNameValues returns the possible values for the KnownAgentSettingName const type. +func PossibleKnownAgentSettingNameValues() []KnownAgentSettingName { + return []KnownAgentSettingName{ + KnownAgentSettingNameMaxDiskQuotaInMB, + KnownAgentSettingNameTags, + KnownAgentSettingNameUseTimeReceivedForForwardedEvents, } } @@ -355,13 +463,20 @@ func PossibleKindValues() []Kind { type KnownColumnDefinitionType string const ( - KnownColumnDefinitionTypeBoolean KnownColumnDefinitionType = "boolean" + // KnownColumnDefinitionTypeBoolean - boolean + KnownColumnDefinitionTypeBoolean KnownColumnDefinitionType = "boolean" + // KnownColumnDefinitionTypeDatetime - datetime KnownColumnDefinitionTypeDatetime KnownColumnDefinitionType = "datetime" - KnownColumnDefinitionTypeDynamic KnownColumnDefinitionType = "dynamic" - KnownColumnDefinitionTypeInt KnownColumnDefinitionType = "int" - KnownColumnDefinitionTypeLong KnownColumnDefinitionType = "long" - KnownColumnDefinitionTypeReal KnownColumnDefinitionType = "real" - KnownColumnDefinitionTypeString KnownColumnDefinitionType = "string" + // KnownColumnDefinitionTypeDynamic - dynamic + KnownColumnDefinitionTypeDynamic KnownColumnDefinitionType = "dynamic" + // KnownColumnDefinitionTypeInt - int + KnownColumnDefinitionTypeInt KnownColumnDefinitionType = "int" + // KnownColumnDefinitionTypeLong - long + KnownColumnDefinitionTypeLong KnownColumnDefinitionType = "long" + // KnownColumnDefinitionTypeReal - real + KnownColumnDefinitionTypeReal KnownColumnDefinitionType = "real" + // KnownColumnDefinitionTypeString - string + KnownColumnDefinitionTypeString KnownColumnDefinitionType = "string" ) // PossibleKnownColumnDefinitionTypeValues returns the possible values for the KnownColumnDefinitionType const type. @@ -381,12 +496,18 @@ func PossibleKnownColumnDefinitionTypeValues() []KnownColumnDefinitionType { type KnownDataCollectionEndpointProvisioningState string const ( - KnownDataCollectionEndpointProvisioningStateCanceled KnownDataCollectionEndpointProvisioningState = "Canceled" - KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" - KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" - KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" + // KnownDataCollectionEndpointProvisioningStateCanceled - Canceled + KnownDataCollectionEndpointProvisioningStateCanceled KnownDataCollectionEndpointProvisioningState = "Canceled" + // KnownDataCollectionEndpointProvisioningStateCreating - Creating + KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" + // KnownDataCollectionEndpointProvisioningStateDeleting - Deleting + KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" + // KnownDataCollectionEndpointProvisioningStateFailed - Failed + KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" + // KnownDataCollectionEndpointProvisioningStateSucceeded - Succeeded KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" - KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" + // KnownDataCollectionEndpointProvisioningStateUpdating - Updating + KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" ) // PossibleKnownDataCollectionEndpointProvisioningStateValues returns the possible values for the KnownDataCollectionEndpointProvisioningState const type. @@ -405,7 +526,9 @@ func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCol type KnownDataCollectionEndpointResourceKind string const ( - KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" + // KnownDataCollectionEndpointResourceKindLinux - Linux + KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" + // KnownDataCollectionEndpointResourceKindWindows - Windows KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" ) @@ -421,12 +544,18 @@ func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollecti type KnownDataCollectionRuleAssociationProvisioningState string const ( - KnownDataCollectionRuleAssociationProvisioningStateCanceled KnownDataCollectionRuleAssociationProvisioningState = "Canceled" - KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" - KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" - KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" + // KnownDataCollectionRuleAssociationProvisioningStateCanceled - Canceled + KnownDataCollectionRuleAssociationProvisioningStateCanceled KnownDataCollectionRuleAssociationProvisioningState = "Canceled" + // KnownDataCollectionRuleAssociationProvisioningStateCreating - Creating + KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" + // KnownDataCollectionRuleAssociationProvisioningStateDeleting - Deleting + KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" + // KnownDataCollectionRuleAssociationProvisioningStateFailed - Failed + KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" + // KnownDataCollectionRuleAssociationProvisioningStateSucceeded - Succeeded KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" - KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" + // KnownDataCollectionRuleAssociationProvisioningStateUpdating - Updating + KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" ) // PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns the possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. @@ -445,12 +574,18 @@ func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []Known type KnownDataCollectionRuleProvisioningState string const ( - KnownDataCollectionRuleProvisioningStateCanceled KnownDataCollectionRuleProvisioningState = "Canceled" - KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" - KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" - KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" + // KnownDataCollectionRuleProvisioningStateCanceled - Canceled + KnownDataCollectionRuleProvisioningStateCanceled KnownDataCollectionRuleProvisioningState = "Canceled" + // KnownDataCollectionRuleProvisioningStateCreating - Creating + KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" + // KnownDataCollectionRuleProvisioningStateDeleting - Deleting + KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" + // KnownDataCollectionRuleProvisioningStateFailed - Failed + KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" + // KnownDataCollectionRuleProvisioningStateSucceeded - Succeeded KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" - KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" + // KnownDataCollectionRuleProvisioningStateUpdating - Updating + KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" ) // PossibleKnownDataCollectionRuleProvisioningStateValues returns the possible values for the KnownDataCollectionRuleProvisioningState const type. @@ -469,7 +604,9 @@ func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollect type KnownDataCollectionRuleResourceKind string const ( - KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" + // KnownDataCollectionRuleResourceKindLinux - Linux + KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" + // KnownDataCollectionRuleResourceKindWindows - Windows KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" ) @@ -484,11 +621,16 @@ func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRu type KnownDataFlowStreams string const ( - KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" + // KnownDataFlowStreamsMicrosoftEvent - Microsoft-Event + KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" + // KnownDataFlowStreamsMicrosoftInsightsMetrics - Microsoft-InsightsMetrics KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" - KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" - KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" - KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" + // KnownDataFlowStreamsMicrosoftPerf - Microsoft-Perf + KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" + // KnownDataFlowStreamsMicrosoftSyslog - Microsoft-Syslog + KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" + // KnownDataFlowStreamsMicrosoftWindowsEvent - Microsoft-WindowsEvent + KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" ) // PossibleKnownDataFlowStreamsValues returns the possible values for the KnownDataFlowStreams const type. @@ -502,14 +644,64 @@ func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { } } +// KnownEtwProviderDataSourceLogLevel - Minimal level of detail to be logged +type KnownEtwProviderDataSourceLogLevel string + +const ( + // KnownEtwProviderDataSourceLogLevelCritical - Critical + KnownEtwProviderDataSourceLogLevelCritical KnownEtwProviderDataSourceLogLevel = "Critical" + // KnownEtwProviderDataSourceLogLevelError - Error + KnownEtwProviderDataSourceLogLevelError KnownEtwProviderDataSourceLogLevel = "Error" + // KnownEtwProviderDataSourceLogLevelInformational - Informational + KnownEtwProviderDataSourceLogLevelInformational KnownEtwProviderDataSourceLogLevel = "Informational" + // KnownEtwProviderDataSourceLogLevelVerbose - Verbose + KnownEtwProviderDataSourceLogLevelVerbose KnownEtwProviderDataSourceLogLevel = "Verbose" + // KnownEtwProviderDataSourceLogLevelWarning - Warning + KnownEtwProviderDataSourceLogLevelWarning KnownEtwProviderDataSourceLogLevel = "Warning" +) + +// PossibleKnownEtwProviderDataSourceLogLevelValues returns the possible values for the KnownEtwProviderDataSourceLogLevel const type. +func PossibleKnownEtwProviderDataSourceLogLevelValues() []KnownEtwProviderDataSourceLogLevel { + return []KnownEtwProviderDataSourceLogLevel{ + KnownEtwProviderDataSourceLogLevelCritical, + KnownEtwProviderDataSourceLogLevelError, + KnownEtwProviderDataSourceLogLevelInformational, + KnownEtwProviderDataSourceLogLevelVerbose, + KnownEtwProviderDataSourceLogLevelWarning, + } +} + +// KnownEtwProviderType - Provider type specification: By Manifest GUID or by Event Source name +type KnownEtwProviderType string + +const ( + // KnownEtwProviderTypeEventSource - EventSource + KnownEtwProviderTypeEventSource KnownEtwProviderType = "EventSource" + // KnownEtwProviderTypeManifest - Manifest + KnownEtwProviderTypeManifest KnownEtwProviderType = "Manifest" +) + +// PossibleKnownEtwProviderTypeValues returns the possible values for the KnownEtwProviderType const type. +func PossibleKnownEtwProviderTypeValues() []KnownEtwProviderType { + return []KnownEtwProviderType{ + KnownEtwProviderTypeEventSource, + KnownEtwProviderTypeManifest, + } +} + type KnownExtensionDataSourceStreams string const ( - KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" + // KnownExtensionDataSourceStreamsMicrosoftEvent - Microsoft-Event + KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" + // KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics - Microsoft-InsightsMetrics KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" - KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" - KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" + // KnownExtensionDataSourceStreamsMicrosoftPerf - Microsoft-Perf + KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" + // KnownExtensionDataSourceStreamsMicrosoftSyslog - Microsoft-Syslog + KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" + // KnownExtensionDataSourceStreamsMicrosoftWindowsEvent - Microsoft-WindowsEvent + KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" ) // PossibleKnownExtensionDataSourceStreamsValues returns the possible values for the KnownExtensionDataSourceStreams const type. @@ -527,12 +719,18 @@ func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceS type KnownLocationSpecProvisioningStatus string const ( - KnownLocationSpecProvisioningStatusCanceled KnownLocationSpecProvisioningStatus = "Canceled" - KnownLocationSpecProvisioningStatusCreating KnownLocationSpecProvisioningStatus = "Creating" - KnownLocationSpecProvisioningStatusDeleting KnownLocationSpecProvisioningStatus = "Deleting" - KnownLocationSpecProvisioningStatusFailed KnownLocationSpecProvisioningStatus = "Failed" + // KnownLocationSpecProvisioningStatusCanceled - Canceled + KnownLocationSpecProvisioningStatusCanceled KnownLocationSpecProvisioningStatus = "Canceled" + // KnownLocationSpecProvisioningStatusCreating - Creating + KnownLocationSpecProvisioningStatusCreating KnownLocationSpecProvisioningStatus = "Creating" + // KnownLocationSpecProvisioningStatusDeleting - Deleting + KnownLocationSpecProvisioningStatusDeleting KnownLocationSpecProvisioningStatus = "Deleting" + // KnownLocationSpecProvisioningStatusFailed - Failed + KnownLocationSpecProvisioningStatusFailed KnownLocationSpecProvisioningStatus = "Failed" + // KnownLocationSpecProvisioningStatusSucceeded - Succeeded KnownLocationSpecProvisioningStatusSucceeded KnownLocationSpecProvisioningStatus = "Succeeded" - KnownLocationSpecProvisioningStatusUpdating KnownLocationSpecProvisioningStatus = "Updating" + // KnownLocationSpecProvisioningStatusUpdating - Updating + KnownLocationSpecProvisioningStatusUpdating KnownLocationSpecProvisioningStatus = "Updating" ) // PossibleKnownLocationSpecProvisioningStatusValues returns the possible values for the KnownLocationSpecProvisioningStatus const type. @@ -551,15 +749,24 @@ func PossibleKnownLocationSpecProvisioningStatusValues() []KnownLocationSpecProv type KnownLogFileTextSettingsRecordStartTimestampFormat string const ( + // KnownLogFileTextSettingsRecordStartTimestampFormatDdMMMYyyyHHMmSsZzz - dd/MMM/yyyy:HH:mm:ss zzz 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" + // KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs - ddMMyy HH:mm:ss + KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "ddMMyy HH:mm:ss" + // KnownLogFileTextSettingsRecordStartTimestampFormatISO8601 - ISO 8601 + KnownLogFileTextSettingsRecordStartTimestampFormatISO8601 KnownLogFileTextSettingsRecordStartTimestampFormat = "ISO 8601" + // KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM - M/D/YYYY HH:MM:SS AM/PM + KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM KnownLogFileTextSettingsRecordStartTimestampFormat = "M/D/YYYY HH:MM:SS AM/PM" + // KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs - MMM d hh:mm:ss + KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "MMM d hh:mm:ss" + // KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS - Mon DD, YYYY HH:MM:SS + KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "Mon DD, YYYY HH:MM:SS" + // KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS - YYYY-MM-DD HH:MM:SS + KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "YYYY-MM-DD HH:MM:SS" + // KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs - yyMMdd HH:mm:ss + KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "yyMMdd HH:mm:ss" + // KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK - yyyy-MM-ddTHH:mm:ssK + KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK KnownLogFileTextSettingsRecordStartTimestampFormat = "yyyy-MM-ddTHH:mm:ssK" ) // PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues returns the possible values for the KnownLogFileTextSettingsRecordStartTimestampFormat const type. @@ -581,21 +788,95 @@ func PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues() []KnownL type KnownLogFilesDataSourceFormat string const ( + // KnownLogFilesDataSourceFormatJSON - json + KnownLogFilesDataSourceFormatJSON KnownLogFilesDataSourceFormat = "json" + // KnownLogFilesDataSourceFormatText - text KnownLogFilesDataSourceFormatText KnownLogFilesDataSourceFormat = "text" ) // PossibleKnownLogFilesDataSourceFormatValues returns the possible values for the KnownLogFilesDataSourceFormat const type. func PossibleKnownLogFilesDataSourceFormatValues() []KnownLogFilesDataSourceFormat { return []KnownLogFilesDataSourceFormat{ + KnownLogFilesDataSourceFormatJSON, KnownLogFilesDataSourceFormatText, } } +type KnownOtelLogsDataSourceStreams string + +const ( + // KnownOtelLogsDataSourceStreamsMicrosoftOTelLogs - Microsoft-OTel-Logs + KnownOtelLogsDataSourceStreamsMicrosoftOTelLogs KnownOtelLogsDataSourceStreams = "Microsoft-OTel-Logs" +) + +// PossibleKnownOtelLogsDataSourceStreamsValues returns the possible values for the KnownOtelLogsDataSourceStreams const type. +func PossibleKnownOtelLogsDataSourceStreamsValues() []KnownOtelLogsDataSourceStreams { + return []KnownOtelLogsDataSourceStreams{ + KnownOtelLogsDataSourceStreamsMicrosoftOTelLogs, + } +} + +type KnownOtelLogsDirectDataSourceStreams string + +const ( + // KnownOtelLogsDirectDataSourceStreamsMicrosoftOTelLogs - Microsoft-OTel-Logs + KnownOtelLogsDirectDataSourceStreamsMicrosoftOTelLogs KnownOtelLogsDirectDataSourceStreams = "Microsoft-OTel-Logs" +) + +// PossibleKnownOtelLogsDirectDataSourceStreamsValues returns the possible values for the KnownOtelLogsDirectDataSourceStreams const type. +func PossibleKnownOtelLogsDirectDataSourceStreamsValues() []KnownOtelLogsDirectDataSourceStreams { + return []KnownOtelLogsDirectDataSourceStreams{ + KnownOtelLogsDirectDataSourceStreamsMicrosoftOTelLogs, + } +} + +type KnownOtelTracesDataSourceStreams string + +const ( + // KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesEvents - Microsoft-OTel-Traces-Events + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesEvents KnownOtelTracesDataSourceStreams = "Microsoft-OTel-Traces-Events" + // KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesResources - Microsoft-OTel-Traces-Resources + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesResources KnownOtelTracesDataSourceStreams = "Microsoft-OTel-Traces-Resources" + // KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesSpans - Microsoft-OTel-Traces-Spans + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesSpans KnownOtelTracesDataSourceStreams = "Microsoft-OTel-Traces-Spans" +) + +// PossibleKnownOtelTracesDataSourceStreamsValues returns the possible values for the KnownOtelTracesDataSourceStreams const type. +func PossibleKnownOtelTracesDataSourceStreamsValues() []KnownOtelTracesDataSourceStreams { + return []KnownOtelTracesDataSourceStreams{ + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesEvents, + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesResources, + KnownOtelTracesDataSourceStreamsMicrosoftOTelTracesSpans, + } +} + +type KnownOtelTracesDirectDataSourceStreams string + +const ( + // KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesEvents - Microsoft-OTel-Traces-Events + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesEvents KnownOtelTracesDirectDataSourceStreams = "Microsoft-OTel-Traces-Events" + // KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesResources - Microsoft-OTel-Traces-Resources + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesResources KnownOtelTracesDirectDataSourceStreams = "Microsoft-OTel-Traces-Resources" + // KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesSpans - Microsoft-OTel-Traces-Spans + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesSpans KnownOtelTracesDirectDataSourceStreams = "Microsoft-OTel-Traces-Spans" +) + +// PossibleKnownOtelTracesDirectDataSourceStreamsValues returns the possible values for the KnownOtelTracesDirectDataSourceStreams const type. +func PossibleKnownOtelTracesDirectDataSourceStreamsValues() []KnownOtelTracesDirectDataSourceStreams { + return []KnownOtelTracesDirectDataSourceStreams{ + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesEvents, + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesResources, + KnownOtelTracesDirectDataSourceStreamsMicrosoftOTelTracesSpans, + } +} + type KnownPerfCounterDataSourceStreams string const ( + // KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics - Microsoft-InsightsMetrics KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" - KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" + // KnownPerfCounterDataSourceStreamsMicrosoftPerf - Microsoft-Perf + KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" ) // PossibleKnownPerfCounterDataSourceStreamsValues returns the possible values for the KnownPerfCounterDataSourceStreams const type. @@ -606,9 +887,24 @@ func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSou } } +type KnownPerformanceCountersOTelDataSourceStreams string + +const ( + // KnownPerformanceCountersOTelDataSourceStreamsMicrosoftOtelPerfMetrics - Microsoft-OtelPerfMetrics + KnownPerformanceCountersOTelDataSourceStreamsMicrosoftOtelPerfMetrics KnownPerformanceCountersOTelDataSourceStreams = "Microsoft-OtelPerfMetrics" +) + +// PossibleKnownPerformanceCountersOTelDataSourceStreamsValues returns the possible values for the KnownPerformanceCountersOTelDataSourceStreams const type. +func PossibleKnownPerformanceCountersOTelDataSourceStreamsValues() []KnownPerformanceCountersOTelDataSourceStreams { + return []KnownPerformanceCountersOTelDataSourceStreams{ + KnownPerformanceCountersOTelDataSourceStreamsMicrosoftOtelPerfMetrics, + } +} + type KnownPrometheusForwarderDataSourceStreams string const ( + // KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics - Microsoft-PrometheusMetrics KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics KnownPrometheusForwarderDataSourceStreams = "Microsoft-PrometheusMetrics" ) @@ -624,8 +920,11 @@ func PossibleKnownPrometheusForwarderDataSourceStreamsValues() []KnownPrometheus type KnownPublicNetworkAccessOptions string const ( - KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" - KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" + // KnownPublicNetworkAccessOptionsDisabled - Disabled + KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" + // KnownPublicNetworkAccessOptionsEnabled - Enabled + KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" + // KnownPublicNetworkAccessOptionsSecuredByPerimeter - SecuredByPerimeter KnownPublicNetworkAccessOptionsSecuredByPerimeter KnownPublicNetworkAccessOptions = "SecuredByPerimeter" ) @@ -638,40 +937,95 @@ func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessO } } +// KnownStorageBlobLookupType - The type of lookup to perform on the blob +type KnownStorageBlobLookupType string + +const ( + // KnownStorageBlobLookupTypeCidr - Cidr + KnownStorageBlobLookupTypeCidr KnownStorageBlobLookupType = "Cidr" + // KnownStorageBlobLookupTypeString - String + KnownStorageBlobLookupTypeString KnownStorageBlobLookupType = "String" +) + +// PossibleKnownStorageBlobLookupTypeValues returns the possible values for the KnownStorageBlobLookupType const type. +func PossibleKnownStorageBlobLookupTypeValues() []KnownStorageBlobLookupType { + return []KnownStorageBlobLookupType{ + KnownStorageBlobLookupTypeCidr, + KnownStorageBlobLookupTypeString, + } +} + type KnownSyslogDataSourceFacilityNames string const ( + // KnownSyslogDataSourceFacilityNamesAlert - alert + KnownSyslogDataSourceFacilityNamesAlert KnownSyslogDataSourceFacilityNames = "alert" + // KnownSyslogDataSourceFacilityNamesAsterisk - * KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" - KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" + // KnownSyslogDataSourceFacilityNamesAudit - audit + KnownSyslogDataSourceFacilityNamesAudit KnownSyslogDataSourceFacilityNames = "audit" + // KnownSyslogDataSourceFacilityNamesAuth - auth + KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" + // KnownSyslogDataSourceFacilityNamesAuthpriv - authpriv 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" + // KnownSyslogDataSourceFacilityNamesClock - clock + KnownSyslogDataSourceFacilityNamesClock KnownSyslogDataSourceFacilityNames = "clock" + // KnownSyslogDataSourceFacilityNamesCron - cron + KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" + // KnownSyslogDataSourceFacilityNamesDaemon - daemon + KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" + // KnownSyslogDataSourceFacilityNamesFtp - ftp + KnownSyslogDataSourceFacilityNamesFtp KnownSyslogDataSourceFacilityNames = "ftp" + // KnownSyslogDataSourceFacilityNamesKern - kern + KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" + // KnownSyslogDataSourceFacilityNamesLocal0 - local0 + KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" + // KnownSyslogDataSourceFacilityNamesLocal1 - local1 + KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" + // KnownSyslogDataSourceFacilityNamesLocal2 - local2 + KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" + // KnownSyslogDataSourceFacilityNamesLocal3 - local3 + KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" + // KnownSyslogDataSourceFacilityNamesLocal4 - local4 + KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" + // KnownSyslogDataSourceFacilityNamesLocal5 - local5 + KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" + // KnownSyslogDataSourceFacilityNamesLocal6 - local6 + KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" + // KnownSyslogDataSourceFacilityNamesLocal7 - local7 + KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" + // KnownSyslogDataSourceFacilityNamesLpr - lpr + KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" + // KnownSyslogDataSourceFacilityNamesMail - mail + KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" + // KnownSyslogDataSourceFacilityNamesMark - mark + KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" + // KnownSyslogDataSourceFacilityNamesNews - news + KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" + // KnownSyslogDataSourceFacilityNamesNopri - nopri + KnownSyslogDataSourceFacilityNamesNopri KnownSyslogDataSourceFacilityNames = "nopri" + // KnownSyslogDataSourceFacilityNamesNtp - ntp + KnownSyslogDataSourceFacilityNamesNtp KnownSyslogDataSourceFacilityNames = "ntp" + // KnownSyslogDataSourceFacilityNamesSyslog - syslog + KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" + // KnownSyslogDataSourceFacilityNamesUser - user + KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" + // KnownSyslogDataSourceFacilityNamesUucp - uucp + KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" ) // PossibleKnownSyslogDataSourceFacilityNamesValues returns the possible values for the KnownSyslogDataSourceFacilityNames const type. func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { return []KnownSyslogDataSourceFacilityNames{ + KnownSyslogDataSourceFacilityNamesAlert, KnownSyslogDataSourceFacilityNamesAsterisk, + KnownSyslogDataSourceFacilityNamesAudit, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, + KnownSyslogDataSourceFacilityNamesClock, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, + KnownSyslogDataSourceFacilityNamesFtp, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, @@ -685,6 +1039,8 @@ func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceF KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, + KnownSyslogDataSourceFacilityNamesNopri, + KnownSyslogDataSourceFacilityNamesNtp, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp, @@ -694,15 +1050,24 @@ func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceF type KnownSyslogDataSourceLogLevels string const ( - KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" - KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" - KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" - KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" + // KnownSyslogDataSourceLogLevelsAlert - Alert + KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" + // KnownSyslogDataSourceLogLevelsAsterisk - * + KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" + // KnownSyslogDataSourceLogLevelsCritical - Critical + KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" + // KnownSyslogDataSourceLogLevelsDebug - Debug + KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" + // KnownSyslogDataSourceLogLevelsEmergency - Emergency KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" - KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" - KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" - KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" - KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" + // KnownSyslogDataSourceLogLevelsError - Error + KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" + // KnownSyslogDataSourceLogLevelsInfo - Info + KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" + // KnownSyslogDataSourceLogLevelsNotice - Notice + KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" + // KnownSyslogDataSourceLogLevelsWarning - Warning + KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" ) // PossibleKnownSyslogDataSourceLogLevelsValues returns the possible values for the KnownSyslogDataSourceLogLevels const type. @@ -723,6 +1088,7 @@ func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLe type KnownSyslogDataSourceStreams string const ( + // KnownSyslogDataSourceStreamsMicrosoftSyslog - Microsoft-Syslog KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" ) @@ -736,7 +1102,9 @@ func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams type KnownWindowsEventLogDataSourceStreams string const ( - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" + // KnownWindowsEventLogDataSourceStreamsMicrosoftEvent - Microsoft-Event + KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" + // KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent - Microsoft-WindowsEvent KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" ) @@ -748,14 +1116,38 @@ func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLo } } +type KnownWindowsFirewallLogsDataSourceProfileFilter string + +const ( + // KnownWindowsFirewallLogsDataSourceProfileFilterDomain - Domain + KnownWindowsFirewallLogsDataSourceProfileFilterDomain KnownWindowsFirewallLogsDataSourceProfileFilter = "Domain" + // KnownWindowsFirewallLogsDataSourceProfileFilterPrivate - Private + KnownWindowsFirewallLogsDataSourceProfileFilterPrivate KnownWindowsFirewallLogsDataSourceProfileFilter = "Private" + // KnownWindowsFirewallLogsDataSourceProfileFilterPublic - Public + KnownWindowsFirewallLogsDataSourceProfileFilterPublic KnownWindowsFirewallLogsDataSourceProfileFilter = "Public" +) + +// PossibleKnownWindowsFirewallLogsDataSourceProfileFilterValues returns the possible values for the KnownWindowsFirewallLogsDataSourceProfileFilter const type. +func PossibleKnownWindowsFirewallLogsDataSourceProfileFilterValues() []KnownWindowsFirewallLogsDataSourceProfileFilter { + return []KnownWindowsFirewallLogsDataSourceProfileFilter{ + KnownWindowsFirewallLogsDataSourceProfileFilterDomain, + KnownWindowsFirewallLogsDataSourceProfileFilterPrivate, + KnownWindowsFirewallLogsDataSourceProfileFilterPublic, + } +} + // ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. @@ -768,16 +1160,22 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// MetricAggregationType - the aggregation type of the metric. +// MetricAggregationType - The aggregation type of the metric. type MetricAggregationType string const ( + // MetricAggregationTypeAverage - Average MetricAggregationTypeAverage MetricAggregationType = "Average" - MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeCount - Count + MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeMaximum - Maximum MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + // MetricAggregationTypeMinimum - Minimum MetricAggregationTypeMinimum MetricAggregationType = "Minimum" - MetricAggregationTypeNone MetricAggregationType = "None" - MetricAggregationTypeTotal MetricAggregationType = "Total" + // MetricAggregationTypeNone - None + MetricAggregationTypeNone MetricAggregationType = "None" + // MetricAggregationTypeTotal - Total + MetricAggregationTypeTotal MetricAggregationType = "Total" ) // PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. @@ -796,10 +1194,15 @@ func PossibleMetricAggregationTypeValues() []MetricAggregationType { type MetricClass string const ( + // MetricClassAvailability - Availability MetricClassAvailability MetricClass = "Availability" - MetricClassErrors MetricClass = "Errors" - MetricClassLatency MetricClass = "Latency" - MetricClassSaturation MetricClass = "Saturation" + // MetricClassErrors - Errors + MetricClassErrors MetricClass = "Errors" + // MetricClassLatency - Latency + MetricClassLatency MetricClass = "Latency" + // MetricClassSaturation - Saturation + MetricClassSaturation MetricClass = "Saturation" + // MetricClassTransactions - Transactions MetricClassTransactions MetricClass = "Transactions" ) @@ -819,7 +1222,9 @@ func PossibleMetricClassValues() []MetricClass { type MetricResultType string const ( - MetricResultTypeData MetricResultType = "Data" + // MetricResultTypeData - Data + MetricResultTypeData MetricResultType = "Data" + // MetricResultTypeMetadata - Metadata MetricResultTypeMetadata MetricResultType = "Metadata" ) @@ -835,11 +1240,16 @@ func PossibleMetricResultTypeValues() []MetricResultType { type MetricStatisticType string const ( + // MetricStatisticTypeAverage - Average MetricStatisticTypeAverage MetricStatisticType = "Average" - MetricStatisticTypeCount MetricStatisticType = "Count" - MetricStatisticTypeMax MetricStatisticType = "Max" - MetricStatisticTypeMin MetricStatisticType = "Min" - MetricStatisticTypeSum MetricStatisticType = "Sum" + // MetricStatisticTypeCount - Count + MetricStatisticTypeCount MetricStatisticType = "Count" + // MetricStatisticTypeMax - Max + MetricStatisticTypeMax MetricStatisticType = "Max" + // MetricStatisticTypeMin - Min + MetricStatisticTypeMin MetricStatisticType = "Min" + // MetricStatisticTypeSum - Sum + MetricStatisticTypeSum MetricStatisticType = "Sum" ) // PossibleMetricStatisticTypeValues returns the possible values for the MetricStatisticType const type. @@ -857,19 +1267,33 @@ func PossibleMetricStatisticTypeValues() []MetricStatisticType { type MetricUnit string const ( - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitBitsPerSecond - Rate unit of binary digits per second. + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitByteSeconds - Unit of data transfer or storage. It is the size of the data in bytes multiplied by the time it + // takes to transfer or store the data in seconds. + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytes - Unit of memory in bytes. + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitBytesPerSecond - Rate unit of memory in bytes per second. MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - MetricUnitCores MetricUnit = "Cores" - MetricUnitCount MetricUnit = "Count" + // MetricUnitCores - Unit of processing power. + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount - Unit of raw quantity. + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond - Rate unit of raw quantity per second. MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - MetricUnitMilliCores MetricUnit = "MilliCores" - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - MetricUnitNanoCores MetricUnit = "NanoCores" - MetricUnitPercent MetricUnit = "Percent" - MetricUnitSeconds MetricUnit = "Seconds" - MetricUnitUnspecified MetricUnit = "Unspecified" + // MetricUnitMilliCores - Unit of processing power in 1/1000th of a CPU core. + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds - Unit of time in 1/1000th of a second. + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores - Unit of processing power in one billionth of a CPU core. + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent - Percentage unit. + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds - Unit of time in seconds. + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified - No specified unit. + MetricUnitUnspecified MetricUnit = "Unspecified" ) // PossibleMetricUnitValues returns the possible values for the MetricUnit const type. @@ -895,9 +1319,12 @@ func PossibleMetricUnitValues() []MetricUnit { type NamespaceClassification string const ( - NamespaceClassificationCustom NamespaceClassification = "Custom" + // NamespaceClassificationCustom - Custom + NamespaceClassificationCustom NamespaceClassification = "Custom" + // NamespaceClassificationPlatform - Platform NamespaceClassificationPlatform NamespaceClassification = "Platform" - NamespaceClassificationQos NamespaceClassification = "Qos" + // NamespaceClassificationQos - Qos + NamespaceClassificationQos NamespaceClassification = "Qos" ) // PossibleNamespaceClassificationValues returns the possible values for the NamespaceClassification const type. @@ -909,52 +1336,71 @@ func PossibleNamespaceClassificationValues() []NamespaceClassification { } } -// Odatatype - specifies the type of the alert criteria. +// NetworkSecurityPerimeterConfigurationProvisioningState - Provisioning state of a network security perimeter configuration +// that is being created or updated. +type NetworkSecurityPerimeterConfigurationProvisioningState string + +const ( + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted NetworkSecurityPerimeterConfigurationProvisioningState = "Accepted" + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled NetworkSecurityPerimeterConfigurationProvisioningState = "Canceled" + NetworkSecurityPerimeterConfigurationProvisioningStateCreating NetworkSecurityPerimeterConfigurationProvisioningState = "Creating" + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting NetworkSecurityPerimeterConfigurationProvisioningState = "Deleting" + NetworkSecurityPerimeterConfigurationProvisioningStateFailed NetworkSecurityPerimeterConfigurationProvisioningState = "Failed" + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded NetworkSecurityPerimeterConfigurationProvisioningState = "Succeeded" + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating NetworkSecurityPerimeterConfigurationProvisioningState = "Updating" +) + +// PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues returns the possible values for the NetworkSecurityPerimeterConfigurationProvisioningState const type. +func PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues() []NetworkSecurityPerimeterConfigurationProvisioningState { + return []NetworkSecurityPerimeterConfigurationProvisioningState{ + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted, + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled, + NetworkSecurityPerimeterConfigurationProvisioningStateCreating, + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting, + NetworkSecurityPerimeterConfigurationProvisioningStateFailed, + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded, + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating, + } +} + +// Odatatype - Specifies the type of the alert criteria. Previously undocumented values might be returned type Odatatype string const ( + // OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria Odatatype = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" + // OdatatypeMicrosoftAzureMonitorPromQLCriteria - Microsoft.Azure.Monitor.PromQLCriteria + OdatatypeMicrosoftAzureMonitorPromQLCriteria Odatatype = "Microsoft.Azure.Monitor.PromQLCriteria" + // OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria + OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" + // OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria + OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria Odatatype = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" ) // PossibleOdatatypeValues returns the possible values for the Odatatype const type. func PossibleOdatatypeValues() []Odatatype { return []Odatatype{ OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, + OdatatypeMicrosoftAzureMonitorPromQLCriteria, 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. +// Operator - The criteria operator. Previously undocumented values might be returned type Operator string const ( - OperatorEquals Operator = "Equals" - OperatorGreaterThan Operator = "GreaterThan" + // OperatorEquals - Equals + OperatorEquals Operator = "Equals" + // OperatorGreaterThan - GreaterThan + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual - GreaterThanOrEqual OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - OperatorLessThan Operator = "LessThan" - OperatorLessThanOrEqual Operator = "LessThanOrEqual" + // OperatorLessThan - LessThan + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual - LessThanOrEqual + OperatorLessThanOrEqual Operator = "LessThanOrEqual" ) // PossibleOperatorValues returns the possible values for the Operator const type. @@ -968,31 +1414,15 @@ func PossibleOperatorValues() []Operator { } } -// 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" + // PredictiveAutoscalePolicyScaleModeDisabled - Disabled + PredictiveAutoscalePolicyScaleModeDisabled PredictiveAutoscalePolicyScaleMode = "Disabled" + // PredictiveAutoscalePolicyScaleModeEnabled - Enabled + PredictiveAutoscalePolicyScaleModeEnabled PredictiveAutoscalePolicyScaleMode = "Enabled" + // PredictiveAutoscalePolicyScaleModeForecastOnly - ForecastOnly PredictiveAutoscalePolicyScaleModeForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" ) @@ -1009,9 +1439,13 @@ func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePol type PrivateEndpointConnectionProvisioningState string const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateCreating - Connection is being created + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting - Connection is being deleted + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed - Connection provisioning has failed + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded - Connection has been provisioned PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" ) @@ -1029,8 +1463,11 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin type PrivateEndpointServiceConnectionStatus string const ( + // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" ) @@ -1043,43 +1480,28 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. -type ProvisioningState string +// PrivateLinkScopeProvisioningState - 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. +type PrivateLinkScopeProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // PrivateLinkScopeProvisioningStateCanceled - Canceled + PrivateLinkScopeProvisioningStateCanceled PrivateLinkScopeProvisioningState = "Canceled" + // PrivateLinkScopeProvisioningStateDeleting - Deleting + PrivateLinkScopeProvisioningStateDeleting PrivateLinkScopeProvisioningState = "Deleting" + // PrivateLinkScopeProvisioningStateFailed - Failed + PrivateLinkScopeProvisioningStateFailed PrivateLinkScopeProvisioningState = "Failed" + // PrivateLinkScopeProvisioningStateSucceeded - Succeeded + PrivateLinkScopeProvisioningStateSucceeded PrivateLinkScopeProvisioningState = "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, +// PossiblePrivateLinkScopeProvisioningStateValues returns the possible values for the PrivateLinkScopeProvisioningState const type. +func PossiblePrivateLinkScopeProvisioningStateValues() []PrivateLinkScopeProvisioningState { + return []PrivateLinkScopeProvisioningState{ + PrivateLinkScopeProvisioningStateCanceled, + PrivateLinkScopeProvisioningStateDeleting, + PrivateLinkScopeProvisioningStateFailed, + PrivateLinkScopeProvisioningStateSucceeded, } } @@ -1087,8 +1509,11 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type ReceiverStatus string const ( - ReceiverStatusDisabled ReceiverStatus = "Disabled" - ReceiverStatusEnabled ReceiverStatus = "Enabled" + // ReceiverStatusDisabled - Disabled + ReceiverStatusDisabled ReceiverStatus = "Disabled" + // ReceiverStatusEnabled - Enabled + ReceiverStatusEnabled ReceiverStatus = "Enabled" + // ReceiverStatusNotSpecified - NotSpecified ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" ) @@ -1102,19 +1527,27 @@ 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. +// 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" + // RecurrenceFrequencyDay - Day + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour - Hour + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute - Minute RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - RecurrenceFrequencyNone RecurrenceFrequency = "None" + // RecurrenceFrequencyMonth - Month + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNone - None + RecurrenceFrequencyNone RecurrenceFrequency = "None" + // RecurrenceFrequencySecond - Second RecurrenceFrequencySecond RecurrenceFrequency = "Second" - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - RecurrenceFrequencyYear RecurrenceFrequency = "Year" + // RecurrenceFrequencyWeek - Week + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear - Year + RecurrenceFrequencyYear RecurrenceFrequency = "Year" ) // PossibleRecurrenceFrequencyValues returns the possible values for the RecurrenceFrequency const type. @@ -1131,10 +1564,35 @@ func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { } } +// ResourceAssociationAccessMode - Access mode of the resource association +type ResourceAssociationAccessMode string + +const ( + // ResourceAssociationAccessModeAudit - Audit access mode - traffic to the resource that fails access checks is logged but + // not blocked + ResourceAssociationAccessModeAudit ResourceAssociationAccessMode = "Audit" + // ResourceAssociationAccessModeEnforced - Enforced access mode - traffic to the resource that failed access checks is blocked + ResourceAssociationAccessModeEnforced ResourceAssociationAccessMode = "Enforced" + // ResourceAssociationAccessModeLearning - Learning access mode - traffic to the resource is enabled for analysis but not + // blocked + ResourceAssociationAccessModeLearning ResourceAssociationAccessMode = "Learning" +) + +// PossibleResourceAssociationAccessModeValues returns the possible values for the ResourceAssociationAccessMode const type. +func PossibleResourceAssociationAccessModeValues() []ResourceAssociationAccessMode { + return []ResourceAssociationAccessMode{ + ResourceAssociationAccessModeAudit, + ResourceAssociationAccessModeEnforced, + ResourceAssociationAccessModeLearning, + } +} + type ResultType string const ( - ResultTypeData ResultType = "Data" + // ResultTypeData - Data + ResultTypeData ResultType = "Data" + // ResultTypeMetadata - Metadata ResultTypeMetadata ResultType = "Metadata" ) @@ -1146,13 +1604,41 @@ func PossibleResultTypeValues() []ResultType { } } +// SKUTier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but +// is not required on a PUT. +type SKUTier string + +const ( + // SKUTierBasic - The Basic service tier. + SKUTierBasic SKUTier = "Basic" + // SKUTierFree - The Free service tier. + SKUTierFree SKUTier = "Free" + // SKUTierPremium - The Premium service tier. + SKUTierPremium SKUTier = "Premium" + // SKUTierStandard - The Standard service tier. + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierBasic, + SKUTierFree, + SKUTierPremium, + SKUTierStandard, + } +} + // ScaleDirection - the scale direction. Whether the scaling action increases or decreases the number of instances. type ScaleDirection string const ( + // ScaleDirectionDecrease - Decrease ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease - Increase ScaleDirectionIncrease ScaleDirection = "Increase" - ScaleDirectionNone ScaleDirection = "None" + // ScaleDirectionNone - None + ScaleDirectionNone ScaleDirection = "None" ) // PossibleScaleDirectionValues returns the possible values for the ScaleDirection const type. @@ -1169,7 +1655,9 @@ func PossibleScaleDirectionValues() []ScaleDirection { type ScaleRuleMetricDimensionOperationType string const ( - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" + // ScaleRuleMetricDimensionOperationTypeEquals - Equals + ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" + // ScaleRuleMetricDimensionOperationTypeNotEquals - NotEquals ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" ) @@ -1185,9 +1673,13 @@ func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDime type ScaleType string const ( - ScaleTypeChangeCount ScaleType = "ChangeCount" - ScaleTypeExactCount ScaleType = "ExactCount" - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" + // ScaleTypeChangeCount - ChangeCount + ScaleTypeChangeCount ScaleType = "ChangeCount" + // ScaleTypeExactCount - ExactCount + ScaleTypeExactCount ScaleType = "ExactCount" + // ScaleTypePercentChangeCount - PercentChangeCount + ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" + // ScaleTypeServiceAllowedNextValue - ServiceAllowedNextValue ScaleTypeServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" ) @@ -1201,15 +1693,78 @@ func PossibleScaleTypeValues() []ScaleType { } } +// ScopedResourceKind - The kind of scoped Azure monitor resource. +type ScopedResourceKind string + +const ( + // ScopedResourceKindMetrics - Metrics + ScopedResourceKindMetrics ScopedResourceKind = "Metrics" + // ScopedResourceKindResource - Resource + ScopedResourceKindResource ScopedResourceKind = "Resource" +) + +// PossibleScopedResourceKindValues returns the possible values for the ScopedResourceKind const type. +func PossibleScopedResourceKindValues() []ScopedResourceKind { + return []ScopedResourceKind{ + ScopedResourceKindMetrics, + ScopedResourceKindResource, + } +} + +// ScopedResourceProvisioningState - State of the Azure monitor resource. +type ScopedResourceProvisioningState string + +const ( + // ScopedResourceProvisioningStateCanceled - Canceled + ScopedResourceProvisioningStateCanceled ScopedResourceProvisioningState = "Canceled" + // ScopedResourceProvisioningStateFailed - Failed + ScopedResourceProvisioningStateFailed ScopedResourceProvisioningState = "Failed" + // ScopedResourceProvisioningStateProvisioning - Provisioning + ScopedResourceProvisioningStateProvisioning ScopedResourceProvisioningState = "Provisioning" + // ScopedResourceProvisioningStateSucceeded - Succeeded + ScopedResourceProvisioningStateSucceeded ScopedResourceProvisioningState = "Succeeded" +) + +// PossibleScopedResourceProvisioningStateValues returns the possible values for the ScopedResourceProvisioningState const type. +func PossibleScopedResourceProvisioningStateValues() []ScopedResourceProvisioningState { + return []ScopedResourceProvisioningState{ + ScopedResourceProvisioningStateCanceled, + ScopedResourceProvisioningStateFailed, + ScopedResourceProvisioningStateProvisioning, + ScopedResourceProvisioningStateSucceeded, + } +} + +// Severity - Severity of the issue. +type Severity string + +const ( + SeverityError Severity = "Error" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityError, + SeverityWarning, + } +} + // TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. type TimeAggregation string const ( + // TimeAggregationAverage - Average TimeAggregationAverage TimeAggregation = "Average" - TimeAggregationCount TimeAggregation = "Count" + // TimeAggregationCount - Count + TimeAggregationCount TimeAggregation = "Count" + // TimeAggregationMaximum - Maximum TimeAggregationMaximum TimeAggregation = "Maximum" + // TimeAggregationMinimum - Minimum TimeAggregationMinimum TimeAggregation = "Minimum" - TimeAggregationTotal TimeAggregation = "Total" + // TimeAggregationTotal - Total + TimeAggregationTotal TimeAggregation = "Total" ) // PossibleTimeAggregationValues returns the possible values for the TimeAggregation const type. @@ -1223,39 +1778,23 @@ func PossibleTimeAggregationValues() []TimeAggregation { } } -// 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 - Average TimeAggregationTypeAverage TimeAggregationType = "Average" - TimeAggregationTypeCount TimeAggregationType = "Count" - TimeAggregationTypeLast TimeAggregationType = "Last" + // TimeAggregationTypeCount - Count + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeLast - Last + TimeAggregationTypeLast TimeAggregationType = "Last" + // TimeAggregationTypeMaximum - Maximum TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum - Minimum TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - TimeAggregationTypeTotal TimeAggregationType = "Total" + // TimeAggregationTypeTotal - Total + TimeAggregationTypeTotal TimeAggregationType = "Total" ) // PossibleTimeAggregationTypeValues returns the possible values for the TimeAggregationType const type. @@ -1269,41 +1808,3 @@ func PossibleTimeAggregationTypeValues() []TimeAggregationType { 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 index 24618b53fab2..2e6a6ef1aaf8 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // DataCollectionEndpointsClient contains the methods for the DataCollectionEndpoints group. // Don't use this type directly, use NewDataCollectionEndpointsClient() instead. +// +// Generated from API versions 2021-10-01, 2024-03-11 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,20 +42,21 @@ func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.T } // 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 +// Creates or updates a data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. // - 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. +// - body - The payload // - 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) { +func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, 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) + req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, body, options) if err != nil { return DataCollectionEndpointsClientCreateResponse{}, err } @@ -71,8 +73,8 @@ func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourc } // 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}" +func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, _ *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") } @@ -90,14 +92,12 @@ func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -112,9 +112,9 @@ func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Res } // Delete - Deletes a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Deletes a data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. // - 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 @@ -141,8 +141,8 @@ func (client *DataCollectionEndpointsClient) Delete(ctx context.Context, resourc } // 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}" +func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, _ *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") } @@ -160,16 +160,15 @@ func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Con 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"} + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 +// Returns the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. // - 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 @@ -197,8 +196,8 @@ func (client *DataCollectionEndpointsClient) Get(ctx context.Context, resourceGr } // 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}" +func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, _ *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") } @@ -216,8 +215,8 @@ func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -231,9 +230,79 @@ func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Respon return result, nil } +// GetNSP - Gets the specified NSP configuration for the specified data collection endpoint. +// +// Gets the specified NSP configuration for the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - DataCollectionEndpointsClientGetNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.GetNSP +// method. +func (client *DataCollectionEndpointsClient) GetNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientGetNSPOptions) (DataCollectionEndpointsClientGetNSPResponse, error) { + var err error + const operationName = "DataCollectionEndpointsClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *DataCollectionEndpointsClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, _ *DataCollectionEndpointsClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + 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)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *DataCollectionEndpointsClient) getNSPHandleResponse(resp *http.Response) (DataCollectionEndpointsClientGetNSPResponse, error) { + result := DataCollectionEndpointsClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return DataCollectionEndpointsClientGetNSPResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Lists all data collection endpoints in the specified resource group. // -// Generated from API version 2022-06-01 +// Lists all data collection endpoints in the specified resource group. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager // method. @@ -261,8 +330,8 @@ func (client *DataCollectionEndpointsClient) NewListByResourceGroupPager(resourc } // 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" +func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") } @@ -276,8 +345,8 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -293,7 +362,7 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(r // NewListBySubscriptionPager - Lists all data collection endpoints in the specified subscription // -// Generated from API version 2022-06-01 +// Lists all data collection endpoints in the specified subscription // - options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager // method. func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options *DataCollectionEndpointsClientListBySubscriptionOptions) *runtime.Pager[DataCollectionEndpointsClientListBySubscriptionResponse] { @@ -320,7 +389,7 @@ func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionEndpointsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *DataCollectionEndpointsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,8 +400,8 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,21 +415,167 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(re return result, nil } -// Update - Updates part of a data collection endpoint. +// NewListNSPPager - Gets a list of NSP configurations for the specified data collection endpoint. +// +// Gets a list of NSP configurations for the specified data collection endpoint. +// - 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 - DataCollectionEndpointsClientListNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListNSPPager +// method. +func (client *DataCollectionEndpointsClient) NewListNSPPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientListNSPOptions) *runtime.Pager[DataCollectionEndpointsClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListNSPResponse]{ + More: func(page DataCollectionEndpointsClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListNSPResponse) (DataCollectionEndpointsClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListNSPPager") + 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.listNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) + }, nil) + if err != nil { + return DataCollectionEndpointsClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *DataCollectionEndpointsClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, _ *DataCollectionEndpointsClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations" + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *DataCollectionEndpointsClient) listNSPHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListNSPResponse, error) { + result := DataCollectionEndpointsClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return DataCollectionEndpointsClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconciles the specified NSP configuration for the specified data collection endpoint. +// +// Reconciles the specified NSP configuration for the specified data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - DataCollectionEndpointsClientBeginReconcileNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.BeginReconcileNSP +// method. +func (client *DataCollectionEndpointsClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*runtime.Poller[DataCollectionEndpointsClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataCollectionEndpointsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataCollectionEndpointsClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconciles the specified NSP configuration for the specified data collection endpoint. // -// Generated from API version 2022-06-01 +// Reconciles the specified NSP configuration for the specified data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *DataCollectionEndpointsClient) reconcileNSP(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "DataCollectionEndpointsClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, networkSecurityPerimeterConfigurationName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *DataCollectionEndpointsClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, _ *DataCollectionEndpointsClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + 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)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// Update - Updates part of a data collection endpoint. +// +// Updates part of a data collection endpoint. +// If the operation fails it returns an *azcore.ResponseError type. // - 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. +// - body - The payload // - 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) { +func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body ResourceForUpdate, 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) + req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, body, options) if err != nil { return DataCollectionEndpointsClientUpdateResponse{}, err } @@ -377,8 +592,8 @@ func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourc } // 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}" +func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body ResourceForUpdate, _ *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") } @@ -396,14 +611,12 @@ func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go index 27d6e05f64a2..76bd62f93357 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go @@ -1,28 +1,280 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2024-03-11/DataCollectionEndpointsCreate.json +func ExampleDataCollectionEndpointsClient_Create_createADataCollectionEndpoint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myDataCollectionEndpoint", armmonitor.DataCollectionEndpointResource{ + Location: to.Ptr("eastus"), + Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + }, + }, + }, 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 = armmonitor.DataCollectionEndpointsClientCreateResponse{ + // DataCollectionEndpointResource: armmonitor.DataCollectionEndpointResource{ + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-11/DataCollectionEndpointsUpdate.json +func ExampleDataCollectionEndpointsClient_Create_updateADataCollectionEndpoint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myDataCollectionEndpoint", armmonitor.DataCollectionEndpointResource{ + Location: to.Ptr("eastus"), + Properties: &armmonitor.DataCollectionEndpointResourceProperties{}, + Tags: map[string]*string{ + "tag1": to.Ptr("A"), + "tag2": to.Ptr("B"), + "tag3": to.Ptr("C"), + }, + }, 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 = armmonitor.DataCollectionEndpointsClientCreateResponse{ + // DataCollectionEndpointResource: armmonitor.DataCollectionEndpointResource{ + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:51:04.551992Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionEndpointsClient().Delete(ctx, "myResourceGroup", "myDataCollectionEndpoint", 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 = armmonitor.DataCollectionEndpointsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionEndpointsClient().Get(ctx, "myResourceGroup", "myDataCollectionEndpoint", 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 = armmonitor.DataCollectionEndpointsClientGetResponse{ + // DataCollectionEndpointResource: armmonitor.DataCollectionEndpointResource{ + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01/NSPForDataCollectionEndpoints_Get.json +func ExampleDataCollectionEndpointsClient_GetNSP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionEndpointsClient().GetNSP(ctx, "exampleRG", "someDataCollectionEndpoint", "somePerimeterConfiguration", 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 = armmonitor.DataCollectionEndpointsClientGetNSPResponse{ + // NetworkSecurityPerimeterConfiguration: armmonitor.NetworkSecurityPerimeterConfiguration{ + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/dataCollectionEndpoints/someDataCollectionEndpoint/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-11/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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -37,80 +289,88 @@ func ExampleDataCollectionEndpointsClient_NewListByResourceGroupPager() { _ = 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"), + // page = armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse{ + // DataCollectionEndpointResourceListResult: armmonitor.DataCollectionEndpointResourceListResult{ + // Value: []*armmonitor.DataCollectionEndpointResource{ + // { + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), // }, - // 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"), + // { + // Name: to.Ptr("herDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000f831-0000-0100-0000-65fd4c290000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-b4ab5f4638d54d38932ac69699e40000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T09:15:20.578873Z"); return t}()), + // CreatedBy: to.Ptr("user2"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T09:15:20.578873Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), + // Tags: map[string]*string{ + // "tag1": to.Ptr("A"), // }, // }, - // 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 +// Generated from example definition: 2024-03-11/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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -125,251 +385,220 @@ func ExampleDataCollectionEndpointsClient_NewListBySubscriptionPager() { _ = 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"), + // page = armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse{ + // DataCollectionEndpointResourceListResult: armmonitor.DataCollectionEndpointResourceListResult{ + // Value: []*armmonitor.DataCollectionEndpointResource{ + // { + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), // }, // }, - // 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"), + // { + // Name: to.Ptr("herDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000f831-0000-0100-0000-65fd4c290000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-b4ab5f4638d54d38932ac69699e40000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://herdatacollectionendpoint-6uww.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T09:15:20.578873Z"); return t}()), + // CreatedBy: to.Ptr("user2"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T09:15:20.578873Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), + // Tags: map[string]*string{ + // "tag1": to.Ptr("A"), // }, // }, - // 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() { +// Generated from example definition: 2021-10-01/NSPForDataCollectionEndpoints_List.json +func ExampleDataCollectionEndpointsClient_NewListNSPPager() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + pager := clientFactory.NewDataCollectionEndpointsClient().NewListNSPPager("exampleRG", "someDataCollectionEndpoint", 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 = armmonitor.DataCollectionEndpointsClientListNSPResponse{ + // NetworkSecurityPerimeterConfigurationListResult: armmonitor.NetworkSecurityPerimeterConfigurationListResult{ + // Value: []*armmonitor.NetworkSecurityPerimeterConfiguration{ + // { + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/dataCollectionEndpoints/someDataCollectionEndpoint/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, + // }, + // }, + // }, + // }, + // } } - // 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() { +// Generated from example definition: 2021-10-01/NSPForDataCollectionEndpoints_Reconcile.json +func ExampleDataCollectionEndpointsClient_BeginReconcileNSP() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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), - }, - }, - }, - }) + poller, err := clientFactory.NewDataCollectionEndpointsClient().BeginReconcileNSP(ctx, "exampleRG", "someDataCollectionEndpoint", "somePerimeterConfiguration", 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"), - // }, - // } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll the result: %v", err) + } } -// 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 +// Generated from example definition: 2024-03-11/DataCollectionEndpointsPatch.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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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{ + res, err := clientFactory.NewDataCollectionEndpointsClient().Update(ctx, "myResourceGroup", "myDataCollectionEndpoint", armmonitor.ResourceForUpdate{ Tags: map[string]*string{ "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), }, - }, - }) + }, 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"), + // res = armmonitor.DataCollectionEndpointsClientUpdateResponse{ + // DataCollectionEndpointResource: armmonitor.DataCollectionEndpointResource{ + // Name: to.Ptr("myDataCollectionEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), + // Etag: to.Ptr("0000ae31-0000-0100-0000-65fd441c0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.handler.control.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dce-cd85a330eb664aa3bc7883cc394b0000"), + // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.ingest.monitor.azure.com"), + // }, + // MetricsIngestion: &armmonitor.DataCollectionEndpointMetricsIngestion{ + // Endpoint: to.Ptr("https://mydatacollectionendpoint-71ib.eastus-1.metrics.ingest.monitor.azure.com"), + // }, + // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // }, + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionEndpointProvisioningStateSucceeded), // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T08:40:59.2431682Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T11:55:22.5074142Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), + // Tags: map[string]*string{ + // "tag1": to.Ptr("A"), // }, // }, - // 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 index 4411d1b7f91e..62729b1bb720 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -14,20 +13,23 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) // DataCollectionRuleAssociationsClient contains the methods for the DataCollectionRuleAssociations group. // Don't use this type directly, use NewDataCollectionRuleAssociationsClient() instead. +// +// Generated from API version 2024-03-11 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,20 +43,21 @@ func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential a } // Create - Creates or updates an association. -// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Creates or updates an association. +// If the operation fails it returns an *azcore.ResponseError type. // - resourceURI - The identifier of the resource. // - associationName - The name of the association. The name is case insensitive. +// - body - The payload // - 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) { +func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body DataCollectionRuleAssociationProxyOnlyResource, 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) + req, err := client.createCreateRequest(ctx, resourceURI, associationName, body, options) if err != nil { return DataCollectionRuleAssociationsClientCreateResponse{}, err } @@ -71,8 +74,11 @@ func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, } // createCreateRequest creates the Create request. -func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { +func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, body DataCollectionRuleAssociationProxyOnlyResource, _ *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -83,14 +89,12 @@ func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -105,10 +109,10 @@ func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *h } // 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. +// Deletes an association. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceURI - The fully qualified Azure Resource manager 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. @@ -134,8 +138,11 @@ func (client *DataCollectionRuleAssociationsClient) Delete(ctx context.Context, } // deleteCreateRequest creates the Delete request. -func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (*policy.Request, error) { +func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, associationName string, _ *DataCollectionRuleAssociationsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -146,17 +153,16 @@ func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx cont 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"} + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. +// Returns the specified association. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceURI - The fully qualified Azure Resource manager 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. @@ -183,8 +189,11 @@ func (client *DataCollectionRuleAssociationsClient) Get(ctx context.Context, res } // getCreateRequest creates the Get request. -func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (*policy.Request, error) { +func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context.Context, resourceURI string, associationName string, _ *DataCollectionRuleAssociationsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -195,8 +204,8 @@ func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -212,7 +221,7 @@ func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http // NewListByDataCollectionEndpointPager - Lists associations for the specified data collection endpoint. // -// Generated from API version 2022-06-01 +// Lists associations for the specified data collection endpoint. // - 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 @@ -241,8 +250,8 @@ func (client *DataCollectionRuleAssociationsClient) NewListByDataCollectionEndpo } // 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" +func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpointCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, _ *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") } @@ -260,8 +269,8 @@ func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpoint return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -277,8 +286,8 @@ func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpoint // NewListByResourcePager - Lists associations for the specified resource. // -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. +// Lists associations for the specified resource. +// - resourceURI - The fully qualified Azure Resource manager 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] { @@ -305,16 +314,19 @@ func (client *DataCollectionRuleAssociationsClient) NewListByResourcePager(resou } // listByResourceCreateRequest creates the ListByResource request. -func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest(ctx context.Context, resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) (*policy.Request, error) { +func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest(ctx context.Context, resourceURI string, _ *DataCollectionRuleAssociationsClientListByResourceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } 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() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -330,7 +342,7 @@ func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse // NewListByRulePager - Lists associations for the specified data collection rule. // -// Generated from API version 2022-06-01 +// Lists associations for the specified data collection rule. // - 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 @@ -360,7 +372,7 @@ func (client *DataCollectionRuleAssociationsClient) NewListByRulePager(resourceG // 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" + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -378,8 +390,14 @@ func (client *DataCollectionRuleAssociationsClient) listByRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go index 947992a23f8d..2856b0d34c19 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go @@ -1,202 +1,133 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2024-03-11/DataCollectionRuleAssociationsCreate.json +func ExampleDataCollectionRuleAssociationsClient_Create_createOrUpdateAssociation() { 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) + 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), - // }, - // }}, - // } + res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/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 = armmonitor.DataCollectionRuleAssociationsClientCreateResponse{ + // DataCollectionRuleAssociationProxyOnlyResource: armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // Name: to.Ptr("myAssociation"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // 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"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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() { +// Generated from example definition: 2024-03-11/DataCollectionRuleAssociationsCreateEndpointAssoc.json +func ExampleDataCollectionRuleAssociationsClient_Create_createOrUpdateAssociationWithADataCollectionEndpoint() { 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) + 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), - // }, - // }}, - // } + res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "configurationAccessEndpoint", armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/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 = armmonitor.DataCollectionRuleAssociationsClientCreateResponse{ + // DataCollectionRuleAssociationProxyOnlyResource: armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // Name: to.Ptr("configurationAccessEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint"), + // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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() { +// Generated from example definition: 2024-03-11/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) + 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), - // }, - // }}, - // } + res, 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) } + // 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 = armmonitor.DataCollectionRuleAssociationsClientDeleteResponse{ + // } } -// 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 +// Generated from example definition: 2024-03-11/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) + clientFactory, err := armmonitor.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -207,82 +138,175 @@ func ExampleDataCollectionRuleAssociationsClient_Get() { // 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), + // res = armmonitor.DataCollectionRuleAssociationsClientGetResponse{ + // DataCollectionRuleAssociationProxyOnlyResource: armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // Name: to.Ptr("myAssociation"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // 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"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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() { +// Generated from example definition: 2024-03-11/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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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) + 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 = armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{ + // DataCollectionRuleAssociationProxyOnlyResourceListResult: armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ + // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // { + // Name: to.Ptr("configurationAccessEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint"), + // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // }, + // }, + // } } - // 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() { +// Generated from example definition: 2024-03-11/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) + 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) + 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 = armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse{ + // DataCollectionRuleAssociationProxyOnlyResourceListResult: armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ + // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // { + // Name: to.Ptr("myAssociation"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // 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"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // { + // Name: to.Ptr("configurationAccessEndpoint"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // Etag: to.Ptr("00000836-0000-0100-0000-65fdd8bc0000"), + // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/configurationAccessEndpoint"), + // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-22T19:15:08.2155156Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-03-11/DataCollectionRuleAssociationsListByRule.json +func ExampleDataCollectionRuleAssociationsClient_NewListByRulePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to finish the request: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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 = armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse{ + // DataCollectionRuleAssociationProxyOnlyResourceListResult: armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ + // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + // { + // Name: to.Ptr("myAssociation"), + // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), + // 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"), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go index d2f48ee8fd82..ba1b538061a3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -14,20 +13,23 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) // DataCollectionRulesClient contains the methods for the DataCollectionRules group. // Don't use this type directly, use NewDataCollectionRulesClient() instead. +// +// Generated from API version 2024-03-11 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,20 +43,21 @@ func NewDataCollectionRulesClient(subscriptionID string, credential azcore.Token } // 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 +// Creates or updates a data collection rule. +// If the operation fails it returns an *azcore.ResponseError type. // - 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. +// - body - The payload // - 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) { +func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body DataCollectionRuleResource, 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) + req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, body, options) if err != nil { return DataCollectionRulesClientCreateResponse{}, err } @@ -71,8 +74,8 @@ func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGro } // 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}" +func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body DataCollectionRuleResource, _ *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") } @@ -90,14 +93,12 @@ func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -112,9 +113,9 @@ func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Respons } // Delete - Deletes a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-06-01 +// Deletes a data collection rule. +// If the operation fails it returns an *azcore.ResponseError type. // - 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 @@ -142,7 +143,7 @@ func (client *DataCollectionRulesClient) Delete(ctx context.Context, resourceGro // 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}" + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -160,16 +161,18 @@ func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context 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"} + reqQP.Set("api-version", version20240311) + if options != nil && options.DeleteAssociations != nil { + reqQP.Set("deleteAssociations", strconv.FormatBool(*options.DeleteAssociations)) + } + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 +// Returns the specified data collection rule. +// If the operation fails it returns an *azcore.ResponseError type. // - 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. @@ -196,8 +199,8 @@ func (client *DataCollectionRulesClient) Get(ctx context.Context, resourceGroupN } // 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}" +func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, _ *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") } @@ -215,8 +218,8 @@ func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -232,7 +235,7 @@ func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists all data collection rules in the specified resource group. // -// Generated from API version 2022-06-01 +// Lists all data collection rules in the specified resource group. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager // method. @@ -260,8 +263,8 @@ func (client *DataCollectionRulesClient) NewListByResourceGroupPager(resourceGro } // 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" +func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") } @@ -275,8 +278,8 @@ func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -292,7 +295,7 @@ func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists all data collection rules in the specified subscription. // -// Generated from API version 2022-06-01 +// Lists all data collection rules in the specified subscription. // - options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager // method. func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *DataCollectionRulesClientListBySubscriptionOptions) *runtime.Pager[DataCollectionRulesClientListBySubscriptionResponse] { @@ -319,7 +322,7 @@ func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *Dat } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionRulesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *DataCollectionRulesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -330,8 +333,8 @@ func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,20 +349,21 @@ func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp * } // 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 +// Updates part of a data collection rule. +// If the operation fails it returns an *azcore.ResponseError type. // - 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. +// - body - The payload // - 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) { +func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body ResourceForUpdate, 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) + req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, body, options) if err != nil { return DataCollectionRulesClientUpdateResponse{}, err } @@ -376,8 +380,8 @@ func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGro } // 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}" +func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body ResourceForUpdate, _ *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") } @@ -395,14 +399,12 @@ func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240311) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go index 675af05f31f0..c6cef67650e7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go @@ -1,541 +1,43 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2024-03-11/DataCollectionRulesCreate.json +func ExampleDataCollectionRulesClient_Create_createOrUpdateDataCollectionRule() { 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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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{ + res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", armmonitor.DataCollectionRuleResource{ Location: to.Ptr("eastus"), Properties: &armmonitor.DataCollectionRuleResourceProperties{ DataFlows: []*armmonitor.DataFlow{ { Destinations: []*string{ - to.Ptr("centralWorkspace")}, + to.Ptr("centralWorkspace"), + }, Streams: []*armmonitor.KnownDataFlowStreams{ to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - }}, + to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent), + }, + }, + }, DataSources: &armmonitor.DataCollectionRuleDataSources{ PerformanceCounters: []*armmonitor.PerfCounterDataSource{ { @@ -544,318 +46,1388 @@ func ExampleDataCollectionRulesClient_Create() { 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")}, + to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length"), + }, SamplingFrequencyInSeconds: to.Ptr[int32](15), Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, + to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf), + }, }, { Name: to.Ptr("appTeamExtraCounters"), CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, + to.Ptr("\\Process(_Total)\\Thread Count"), + }, SamplingFrequencyInSeconds: to.Ptr[int32](30), Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, + to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf), + }, + }, + }, Syslog: []*armmonitor.SyslogDataSource{ { Name: to.Ptr("cronSyslog"), FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, + to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron), + }, LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, + to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency), + }, Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, + to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog), + }, }, { Name: to.Ptr("syslogBase"), FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, + to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog), + }, LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, + to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency), + }, Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, + to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog), + }, + }, + }, WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ { Name: to.Ptr("cloudSecurityTeamEvents"), Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, + to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent), + }, XPathQueries: []*string{ - to.Ptr("Security!")}, + to.Ptr("Security!"), + }, }, { Name: to.Ptr("appTeam1AppEvents"), Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, + 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)]]")}, - }}, + 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"), - }}, + }, + }, }, }, - }, - }) + }, 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")}, + // res = armmonitor.DataCollectionRulesClientCreateResponse{ + // 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{ + // 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); 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: 2024-03-11/DataCollectionRulesCreateAgentSettings.json +func ExampleDataCollectionRulesClient_Create_createOrUpdateAnAgentSettingsConfiguration() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", armmonitor.DataCollectionRuleResource{ + Kind: to.Ptr(armmonitor.KnownDataCollectionRuleResourceKind("AgentSettings")), + Location: to.Ptr("eastus"), + Properties: &armmonitor.DataCollectionRuleResourceProperties{ + Description: to.Ptr("An agent settings configuration"), + AgentSettings: &armmonitor.DataCollectionRuleAgentSettings{ + Logs: []*armmonitor.AgentSetting{ + { + Name: to.Ptr(armmonitor.KnownAgentSettingNameMaxDiskQuotaInMB), + Value: to.Ptr("5000"), + }, + { + Name: to.Ptr(armmonitor.KnownAgentSettingNameUseTimeReceivedForForwardedEvents), + Value: to.Ptr("1"), + }, + { + Name: to.Ptr(armmonitor.KnownAgentSettingNameTags), + Value: to.Ptr("Azure, Monitoring"), + }, + }, + }, + }, + }, 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 = armmonitor.DataCollectionRulesClientCreateResponse{ + // 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"), + // Kind: to.Ptr(armmonitor.KnownDataCollectionRuleResourceKind("AgentSettings")), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionRuleResourceProperties{ + // Description: to.Ptr("An agent settings configuration"), + // AgentSettings: &armmonitor.DataCollectionRuleAgentSettings{ + // Logs: []*armmonitor.AgentSetting{ + // { + // Name: to.Ptr(armmonitor.KnownAgentSettingNameMaxDiskQuotaInMB), + // Value: to.Ptr("5000"), + // }, + // { + // Name: to.Ptr(armmonitor.KnownAgentSettingNameUseTimeReceivedForForwardedEvents), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr(armmonitor.KnownAgentSettingNameTags), + // Value: to.Ptr("Azure, Monitoring"), + // }, + // }, + // }, + // ImmutableID: to.Ptr("dcr-76ce901eee3a400b9945b1e263a70000"), + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-26T05:41:40.7885407Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-26T05:41:40.7885407Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-11/DataCollectionRulesCreateEmbeddedDCE.json +func ExampleDataCollectionRulesClient_Create_createOrUpdateDataCollectionRuleWithEmbeddedIngestionEndpoints() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", armmonitor.DataCollectionRuleResource{ + Kind: to.Ptr(armmonitor.KnownDataCollectionRuleResourceKind(" Direct")), + Location: to.Ptr("eastus"), + Properties: &armmonitor.DataCollectionRuleResourceProperties{ + Description: to.Ptr("A Direct Ingestion Rule with builtin ingestion fqdns"), + DataFlows: []*armmonitor.DataFlow{ + { + Destinations: []*string{ + to.Ptr("myworkspace"), + }, + OutputStream: to.Ptr("Custom-LOGS1_CL"), + Streams: []*armmonitor.KnownDataFlowStreams{ + to.Ptr(armmonitor.KnownDataFlowStreams("Custom-LOGS1_CL")), + }, + TransformKql: to.Ptr("source | extend jsonContext = parse_json(AdditionalContext) | project TimeGenerated = Time, Computer, AdditionalContext = jsonContext, CounterName=tostring(jsonContext.CounterName), CounterValue=toreal(jsonContext.CounterValue)"), + }, + }, + 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"), + }, + }, + }, + StreamDeclarations: map[string]*armmonitor.StreamDeclaration{ + "Custom-LOGS1_CL": { + Columns: []*armmonitor.ColumnDefinition{ + { + Name: to.Ptr("Time"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeDatetime), + }, + { + Name: to.Ptr("Computer"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + }, + { + Name: to.Ptr("AdditionalContext"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + }, + { + Name: to.Ptr("CounterName"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + }, + { + Name: to.Ptr("CounterValue"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeReal), + }, + }, + }, + }, + }, + }, 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 = armmonitor.DataCollectionRulesClientCreateResponse{ + // 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"), + // Kind: to.Ptr(armmonitor.KnownDataCollectionRuleResourceKind("Direct")), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.DataCollectionRuleResourceProperties{ + // Description: to.Ptr("A Direct Ingestion Rule with builtin ingestion fqdns"), + // DataFlows: []*armmonitor.DataFlow{ + // { + // Destinations: []*string{ + // to.Ptr("myworkspace"), + // }, + // OutputStream: to.Ptr("Custom-LOGS1_CL"), + // Streams: []*armmonitor.KnownDataFlowStreams{ + // to.Ptr(armmonitor.KnownDataFlowStreams("Custom-LOGS1_CL")), + // }, + // TransformKql: to.Ptr("source | extend jsonContext = parse_json(AdditionalContext) | project TimeGenerated = Time, Computer, AdditionalContext = jsonContext, CounterName=tostring(jsonContext.CounterName), CounterValue=toreal(jsonContext.CounterValue)"), + // }, + // }, + // 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"), + // }, + // }, + // }, + // Endpoints: &armmonitor.DataCollectionRuleEndpoints{ + // LogsIngestion: to.Ptr("https://mycollectionrule-8ykm-eastus2euap.logs.z1.canary.ingest.monitor.azure.com"), + // MetricsIngestion: to.Ptr("https://mycollectionrule-jcvc-eastus2euap.metrics.z1.canary.ingest.monitor.azure.com"), + // }, + // ImmutableID: to.Ptr("dcr-d2a09c11a66243009af059a655750000"), + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), + // StreamDeclarations: map[string]*armmonitor.StreamDeclaration{ + // "Custom-LOGS1_CL": &armmonitor.StreamDeclaration{ + // Columns: []*armmonitor.ColumnDefinition{ + // { + // Name: to.Ptr("Time"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeDatetime), + // }, + // { + // Name: to.Ptr("Computer"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + // }, + // { + // Name: to.Ptr("AdditionalContext"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + // }, + // { + // Name: to.Ptr("CounterName"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + // }, // { - // 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("CounterValue"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeReal), + // }, + // }, + // }, + // }, + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T17:50:40.5383301Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T17:50:40.5383301Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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/DataCollectionRulesUpdate.json -func ExampleDataCollectionRulesClient_Update() { +// Generated from example definition: 2024-03-11/DataCollectionRulesCreateEnrichment.json +func ExampleDataCollectionRulesClient_Create_createOrUpdateDataCollectionRuleWithEnrichment() { 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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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"), + res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", armmonitor.DataCollectionRuleResource{ + Location: to.Ptr("eastus"), + Properties: &armmonitor.DataCollectionRuleResourceProperties{ + Description: to.Ptr("A rule showcasing ingestion time enrichment"), + DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + DataFlows: []*armmonitor.DataFlow{ + { + Destinations: []*string{ + to.Ptr("centralWorkspace"), + }, + OutputStream: to.Ptr("Custom-LOGS1_CL"), + Streams: []*armmonitor.KnownDataFlowStreams{ + to.Ptr(armmonitor.KnownDataFlowStreams("Custom-TabularDataABC")), + }, + TransformKql: to.Ptr("source | extend LookupData = lookup_string_am('mytextdatastore', Message) | project TimeGenerated, Message, AdditionalContext = LookupData.Message"), + }, + }, + DataSources: &armmonitor.DataCollectionRuleDataSources{ + LogFiles: []*armmonitor.LogFilesDataSource{ + { + Name: to.Ptr("myTabularLogDataSource"), + Format: to.Ptr(armmonitor.KnownLogFilesDataSourceFormatText), + FilePatterns: []*string{ + to.Ptr("C:\\JavaLogs\\*\\*.log"), + }, + Settings: &armmonitor.LogFilesDataSourceSettings{ + Text: &armmonitor.LogFileSettingsText{ + RecordStartTimestampFormat: to.Ptr(armmonitor.KnownLogFileTextSettingsRecordStartTimestampFormatISO8601), + }, + }, + Streams: []*string{ + to.Ptr("Custom-TabularDataABC"), + }, + }, + }, + }, + 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"), + }, + }, + }, + References: &armmonitor.DataCollectionRuleReferences{ + EnrichmentData: &armmonitor.ReferencesSpecEnrichmentData{ + StorageBlobs: []*armmonitor.StorageBlob{ + { + Name: to.Ptr("mytextdatastore"), + BlobURL: to.Ptr("https://myenrichmentstorage.blob.core.windows.net/enrichment"), + LookupType: to.Ptr(armmonitor.KnownStorageBlobLookupTypeString), + ResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourcegroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myenrichmentstorage"), + }, + }, + }, + }, + StreamDeclarations: map[string]*armmonitor.StreamDeclaration{ + "Custom-TabularDataABC": { + Columns: []*armmonitor.ColumnDefinition{ + { + Name: to.Ptr("TimeGenerated"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeDatetime), + }, + { + Name: to.Ptr("Message"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + }, + { + Name: to.Ptr("AdditionalContext"), + Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + }, + }, + }, + }, }, - }, - }) + }, 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")}, + // res = armmonitor.DataCollectionRulesClientCreateResponse{ + // 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{ + // Description: to.Ptr("A rule showcasing ingestion time enrichment"), + // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myDataCollectionEndpoint"), + // DataFlows: []*armmonitor.DataFlow{ + // { + // Destinations: []*string{ + // to.Ptr("centralWorkspace"), + // }, + // OutputStream: to.Ptr("Custom-LOGS1_CL"), // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ + // to.Ptr(armmonitor.KnownDataFlowStreams("Custom-TabularDataABC")), + // }, + // TransformKql: to.Ptr("source | extend LookupData = lookup_string_am('mytextdatastore', Message) | project TimeGenerated, Message, AdditionalContext = LookupData.Message"), + // }, + // }, + // DataSources: &armmonitor.DataCollectionRuleDataSources{ + // LogFiles: []*armmonitor.LogFilesDataSource{ + // { + // Name: to.Ptr("myTabularLogDataSource"), + // Format: to.Ptr(armmonitor.KnownLogFilesDataSourceFormatText), + // FilePatterns: []*string{ + // to.Ptr("C:\\JavaLogs\\*\\*.log"), + // }, + // Settings: &armmonitor.LogFilesDataSourceSettings{ + // Text: &armmonitor.LogFileSettingsText{ + // RecordStartTimestampFormat: to.Ptr(armmonitor.KnownLogFileTextSettingsRecordStartTimestampFormatISO8601), + // }, + // }, + // Streams: []*string{ + // to.Ptr("Custom-TabularDataABC"), + // }, + // }, + // }, + // }, + // 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-ad96300ff0734d08a6a7195eb2be0000"), + // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), + // References: &armmonitor.DataCollectionRuleReferences{ + // EnrichmentData: &armmonitor.ReferencesSpecEnrichmentData{ + // StorageBlobs: []*armmonitor.StorageBlob{ // { - // 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"), - // }, - // } + // Name: to.Ptr("mytextdatastore"), + // BlobURL: to.Ptr("https://myenrichmentstorage.blob.core.windows.net/enrichment"), + // LookupType: to.Ptr(armmonitor.KnownStorageBlobLookupTypeString), + // ResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourcegroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myenrichmentstorage"), + // }, + // }, + // }, + // }, + // StreamDeclarations: map[string]*armmonitor.StreamDeclaration{ + // "Custom-TabularDataABC": &armmonitor.StreamDeclaration{ + // Columns: []*armmonitor.ColumnDefinition{ + // { + // Name: to.Ptr("TimeGenerated"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeDatetime), + // }, + // { + // Name: to.Ptr("Message"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + // }, + // { + // Name: to.Ptr("AdditionalContext"), + // Type: to.Ptr(armmonitor.KnownColumnDefinitionTypeString), + // }, + // }, + // }, + // }, + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T17:50:40.5383301Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T17:50:40.5383301Z"); return t}()), + // LastModifiedBy: to.Ptr("user1"), + // 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/DataCollectionRulesDelete.json +// Generated from example definition: 2024-03-11/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) + clientFactory, err := armmonitor.NewClientFactory("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDataCollectionRulesClient().Delete(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 = armmonitor.DataCollectionRulesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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 = armmonitor.DataCollectionRulesClientGetResponse{ + // 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); 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: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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 = armmonitor.DataCollectionRulesClientListByResourceGroupResponse{ + // 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("C"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", 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 = armmonitor.DataCollectionRulesClientListBySubscriptionResponse{ + // 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("C"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-03-11/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("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewDataCollectionRulesClient().Delete(ctx, "myResourceGroup", "myCollectionRule", nil) + res, err := clientFactory.NewDataCollectionRulesClient().Update(ctx, "myResourceGroup", "myCollectionRule", armmonitor.ResourceForUpdate{ + Tags: map[string]*string{ + "tag1": to.Ptr("A"), + "tag2": to.Ptr("B"), + "tag3": to.Ptr("C"), + }, + }, 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 = armmonitor.DataCollectionRulesClientUpdateResponse{ + // 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.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.1234567Z"); 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.1234567Z"); 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"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go deleted file mode 100644 index 4474faf904ce..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 529aba62a286..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 c05fcb3bbc61..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 7913698a0342..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 index 4ceb3f1547de..54e65d6ce7cf 100644 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -12,17 +11,20 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "strings" ) // EventCategoriesClient contains the methods for the EventCategories group. // Don't use this type directly, use NewEventCategoriesClient() instead. +// +// Generated from API version 2015-04-01 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. +// - options - Contains optional client configuration. 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 { @@ -34,30 +36,27 @@ func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.Cl return client, nil } -// NewListPager - Get the list of available event categories supported in the Activity Logs Service. The current list includes +// 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 EventCategoriesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventCategoriesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -65,15 +64,15 @@ func (client *EventCategoriesClient) NewListPager(options *EventCategoriesClient } // listCreateRequest creates the List request. -func (client *EventCategoriesClient) listCreateRequest(ctx context.Context, options *EventCategoriesClientListOptions) (*policy.Request, error) { +func (client *EventCategoriesClient) listCreateRequest(ctx context.Context, _ *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() + reqQP.Set("api-version", version20150401) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go index 0b13a4f4939a..2c1156b34679 100644 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2015-04-01/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) + clientFactory, err := armmonitor.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,16 +33,19 @@ func ExampleEventCategoriesClient_NewListPager() { _ = 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"), + // page = armmonitor.EventCategoriesClientListResponse{ + // EventCategoryCollection: armmonitor.EventCategoryCollection{ + // Value: []*armmonitor.LocalizableString{ + // { + // LocalizedValue: to.Ptr("category1"), + // Value: to.Ptr("category1"), + // }, + // { + // LocalizedValue: to.Ptr("category2"), + // Value: to.Ptr("category2"), + // }, // }, - // { - // 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 58b037c82b0e..cb08166dd462 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( 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" + "slices" ) // ActionGroupsServer is a fake server for instances of the armmonitor.ActionGroupsClient type. @@ -40,6 +41,10 @@ type ActionGroupsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, actionGroupName string, options *armmonitor.ActionGroupsClientGetOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetResponse], errResp azfake.ErrorResponder) + // GetNSP is the fake for method ActionGroupsClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ActionGroupsClientGetNSPOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetNSPResponse], errResp azfake.ErrorResponder) + // GetTestNotificationsAtActionGroupResourceLevel is the fake for method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel // HTTP status codes to indicate success: http.StatusOK GetTestNotificationsAtActionGroupResourceLevel func(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, options *armmonitor.ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) @@ -52,6 +57,14 @@ type ActionGroupsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionIDPager func(options *armmonitor.ActionGroupsClientListBySubscriptionIDOptions) (resp azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]) + // NewListNSPPager is the fake for method ActionGroupsClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, actionGroupName string, options *armmonitor.ActionGroupsClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method ActionGroupsClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, actionGroupName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ActionGroupsClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse], errResp azfake.ErrorResponder) + // Update is the fake for method ActionGroupsClient.Update // HTTP status codes to indicate success: http.StatusOK Update func(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch armmonitor.ActionGroupPatchBody, options *armmonitor.ActionGroupsClientUpdateOptions) (resp azfake.Responder[armmonitor.ActionGroupsClientUpdateResponse], errResp azfake.ErrorResponder) @@ -66,6 +79,8 @@ func NewActionGroupsServerTransport(srv *ActionGroupsServer) *ActionGroupsServer beginCreateNotificationsAtActionGroupResourceLevel: newTracker[azfake.PollerResponder[armmonitor.ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListByResourceGroupResponse]](), newListBySubscriptionIDPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]](), + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse]](), } } @@ -76,6 +91,8 @@ type ActionGroupsServerTransport struct { beginCreateNotificationsAtActionGroupResourceLevel *tracker[azfake.PollerResponder[armmonitor.ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListByResourceGroupResponse]] newListBySubscriptionIDPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListBySubscriptionIDResponse]] + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.ActionGroupsClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.ActionGroupsClientReconcileNSPResponse]] } // Do implements the policy.Transporter interface for ActionGroupsServerTransport. @@ -86,37 +103,57 @@ 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, 1) + 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.GetNSP": + res.resp, res.err = a.dispatchGetNSP(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.NewListNSPPager": + res.resp, res.err = a.dispatchNewListNSPPager(req) + case "ActionGroupsClient.BeginReconcileNSP": + res.resp, res.err = a.dispatchBeginReconcileNSP(req) + case "ActionGroupsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + resultChan <- res + }() + + 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) { @@ -125,10 +162,10 @@ func (a *ActionGroupsServerTransport) dispatchBeginCreateNotificationsAtActionGr } beginCreateNotificationsAtActionGroupResourceLevel := a.beginCreateNotificationsAtActionGroupResourceLevel.get(req) if beginCreateNotificationsAtActionGroupResourceLevel == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createNotifications` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createNotifications` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.NotificationRequestBody](req) @@ -156,7 +193,7 @@ func (a *ActionGroupsServerTransport) dispatchBeginCreateNotificationsAtActionGr return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { a.beginCreateNotificationsAtActionGroupResourceLevel.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -171,10 +208,10 @@ func (a *ActionGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) 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/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ActionGroupResource](req) @@ -194,7 +231,7 @@ func (a *ActionGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.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).ActionGroupResource, req) @@ -208,10 +245,10 @@ func (a *ActionGroupsServerTransport) dispatchDelete(req *http.Request) (*http.R 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/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -227,7 +264,7 @@ func (a *ActionGroupsServerTransport) dispatchDelete(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -241,10 +278,10 @@ func (a *ActionGroupsServerTransport) dispatchEnableReceiver(req *http.Request) if a.srv.EnableReceiver == nil { return nil, &nonRetriableError{errors.New("fake for method EnableReceiver not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscribe` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscribe` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.EnableRequest](req) @@ -264,7 +301,7 @@ func (a *ActionGroupsServerTransport) dispatchEnableReceiver(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -278,10 +315,10 @@ func (a *ActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp 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/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -297,7 +334,7 @@ func (a *ActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ActionGroupResource, req) @@ -307,6 +344,43 @@ func (a *ActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp return resp, nil } +func (a *ActionGroupsServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if a.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetNSP(req.Context(), resourceGroupNameParam, actionGroupNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (a *ActionGroupsServerTransport) dispatchGetTestNotificationsAtActionGroupResourceLevel(req *http.Request) (*http.Response, error) { if a.srv.GetTestNotificationsAtActionGroupResourceLevel == nil { return nil, &nonRetriableError{errors.New("fake for method GetTestNotificationsAtActionGroupResourceLevel not implemented")} @@ -314,7 +388,7 @@ func (a *ActionGroupsServerTransport) dispatchGetTestNotificationsAtActionGroupR const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/notificationStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -334,7 +408,7 @@ func (a *ActionGroupsServerTransport) dispatchGetTestNotificationsAtActionGroupR return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).TestNotificationDetailsResponse, req) @@ -350,10 +424,10 @@ func (a *ActionGroupsServerTransport) dispatchNewListByResourceGroupPager(req *h } 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/actionGroups` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -363,12 +437,15 @@ func (a *ActionGroupsServerTransport) dispatchNewListByResourceGroupPager(req *h resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.ActionGroupsClientListByResourceGroupResponse, 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) { + if !slices.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)} } @@ -387,18 +464,21 @@ func (a *ActionGroupsServerTransport) dispatchNewListBySubscriptionIDPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { 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.ActionGroupsClientListBySubscriptionIDResponse, 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) { + if !slices.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)} } @@ -408,14 +488,103 @@ func (a *ActionGroupsServerTransport) dispatchNewListBySubscriptionIDPager(req * return resp, nil } +func (a *ActionGroupsServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := a.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListNSPPager(resourceGroupNameParam, actionGroupNameParam, nil) + newListNSPPager = &resp + a.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.ActionGroupsClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + a.newListNSPPager.remove(req) + } + return resp, nil +} + +func (a *ActionGroupsServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if a.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := a.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + actionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("actionGroupName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, actionGroupNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + a.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginReconcileNSP.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(beginReconcileNSP) { + a.beginReconcileNSP.remove(req) + } + + return resp, nil +} + func (a *ActionGroupsServerTransport) 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/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/actionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ActionGroupPatchBody](req) @@ -435,7 +604,7 @@ func (a *ActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ActionGroupResource, req) @@ -444,3 +613,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 index ea47ce4e02ae..67c7e78d6123 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ActivityLogAlertsServer is a fake server for instances of the armmonitor.ActivityLogAlertsClient type. @@ -73,41 +73,55 @@ func (a *ActivityLogAlertsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - 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) - } +func (a *ActivityLogAlertsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if activityLogAlertsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = activityLogAlertsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ActivityLogAlertsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ActivityLogAlertsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ActivityLogAlertsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ActivityLogAlertsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "ActivityLogAlertsClient.NewListBySubscriptionIDPager": + res.resp, res.err = a.dispatchNewListBySubscriptionIDPager(req) + case "ActivityLogAlertsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ActivityLogAlertResource](req) @@ -127,7 +141,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchCreateOrUpdate(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.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) @@ -141,10 +155,10 @@ func (a *ActivityLogAlertsServerTransport) dispatchDelete(req *http.Request) (*h 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -160,7 +174,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchDelete(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -174,10 +188,10 @@ func (a *ActivityLogAlertsServerTransport) dispatchGet(req *http.Request) (*http 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -193,7 +207,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -209,10 +223,10 @@ func (a *ActivityLogAlertsServerTransport) dispatchNewListByResourceGroupPager(r } 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` + 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,7 +244,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchNewListByResourceGroupPager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -249,7 +263,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchNewListBySubscriptionIDPager( 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionIDPager(nil) @@ -263,7 +277,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchNewListBySubscriptionIDPager( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -277,10 +291,10 @@ func (a *ActivityLogAlertsServerTransport) dispatchUpdate(req *http.Request) (*h 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRulePatchObject](req) @@ -300,7 +314,7 @@ func (a *ActivityLogAlertsServerTransport) dispatchUpdate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -309,3 +323,9 @@ func (a *ActivityLogAlertsServerTransport) dispatchUpdate(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to ActivityLogAlertsServerTransport +var activityLogAlertsServerTransportInterceptor 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/activitylogs_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go index c1b998f8544d..1244729dbaa1 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,8 +13,8 @@ import ( "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" + "slices" ) // ActivityLogsServer is a fake server for instances of the armmonitor.ActivityLogsClient type. @@ -50,21 +49,35 @@ func (a *ActivityLogsServerTransport) 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 + return a.dispatchToMethodFake(req, method) +} - switch method { - case "ActivityLogsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *ActivityLogsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if activityLogsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = activityLogsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ActivityLogsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,26 +89,18 @@ func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (* 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 { + if len(matches) < 2 { 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) + selectParam := getOptional(qp.Get("$select")) var options *armmonitor.ActivityLogsClientListOptions if selectParam != nil { options = &armmonitor.ActivityLogsClientListOptions{ Select: selectParam, } } - resp := a.srv.NewListPager(filterParam, options) + resp := a.srv.NewListPager(qp.Get("$filter"), options) newListPager = &resp a.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.ActivityLogsClientListResponse, createLink func() string) { @@ -106,7 +111,7 @@ func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -115,3 +120,9 @@ func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to ActivityLogsServerTransport +var activityLogsServerTransportInterceptor 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/alertruleincidents_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go index 845a0a24c3ee..60cae9194015 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( 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" + "slices" ) // AlertRuleIncidentsServer is a fake server for instances of the armmonitor.AlertRuleIncidentsClient type. @@ -54,23 +55,37 @@ func (a *AlertRuleIncidentsServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - 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) - } +func (a *AlertRuleIncidentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if alertRuleIncidentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertRuleIncidentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertRuleIncidentsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AlertRuleIncidentsClient.NewListByAlertRulePager": + res.resp, res.err = a.dispatchNewListByAlertRulePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AlertRuleIncidentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -80,7 +95,7 @@ func (a *AlertRuleIncidentsServerTransport) dispatchGet(req *http.Request) (*htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -100,7 +115,7 @@ func (a *AlertRuleIncidentsServerTransport) dispatchGet(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -116,10 +131,10 @@ func (a *AlertRuleIncidentsServerTransport) dispatchNewListByAlertRulePager(req } 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` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -133,12 +148,15 @@ func (a *AlertRuleIncidentsServerTransport) dispatchNewListByAlertRulePager(req resp := a.srv.NewListByAlertRulePager(resourceGroupNameParam, ruleNameParam, nil) newListByAlertRulePager = &resp a.newListByAlertRulePager.add(req, newListByAlertRulePager) + server.PagerResponderInjectNextLinks(newListByAlertRulePager, req, func(page *armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByAlertRulePager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -147,3 +165,9 @@ func (a *AlertRuleIncidentsServerTransport) dispatchNewListByAlertRulePager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to AlertRuleIncidentsServerTransport +var alertRuleIncidentsServerTransportInterceptor 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/alertrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go deleted file mode 100644 index 760e406184c0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 index bc63b668b0de..2e26ffeb458f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AutoscaleSettingsServer is a fake server for instances of the armmonitor.AutoscaleSettingsClient type. @@ -73,31 +73,45 @@ func (a *AutoscaleSettingsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - 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) - } +func (a *AutoscaleSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if autoscaleSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autoscaleSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutoscaleSettingsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AutoscaleSettingsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AutoscaleSettingsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutoscaleSettingsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AutoscaleSettingsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AutoscaleSettingsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutoscaleSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -107,7 +121,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchCreateOrUpdate(req *http.Requ 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResource](req) @@ -127,7 +141,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchCreateOrUpdate(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.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) @@ -144,7 +158,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchDelete(req *http.Request) (*h 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -160,7 +174,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchDelete(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -177,7 +191,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchGet(req *http.Request) (*http 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -193,7 +207,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -212,7 +226,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchNewListByResourceGroupPager(r 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,7 +244,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchNewListByResourceGroupPager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -249,7 +263,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchNewListBySubscriptionPager(re 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -263,7 +277,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchNewListBySubscriptionPager(re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -280,7 +294,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchUpdate(req *http.Request) (*h 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResourcePatch](req) @@ -300,7 +314,7 @@ func (a *AutoscaleSettingsServerTransport) dispatchUpdate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -309,3 +323,9 @@ func (a *AutoscaleSettingsServerTransport) dispatchUpdate(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to AutoscaleSettingsServerTransport +var autoscaleSettingsServerTransportInterceptor 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/azuremonitorworkspaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go deleted file mode 100644 index 740036c41fd1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 index e55776742b38..458145a69e8a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,10 +10,12 @@ import ( 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" + "slices" ) // BaselinesServer is a fake server for instances of the armmonitor.BaselinesClient type. @@ -49,21 +50,35 @@ func (b *BaselinesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return b.dispatchToMethodFake(req, method) +} - switch method { - case "BaselinesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (b *BaselinesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if baselinesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = baselinesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BaselinesClient.NewListPager": + res.resp, res.err = b.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -75,7 +90,7 @@ func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*htt 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -83,46 +98,14 @@ func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*htt 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)) + metricnamesParam := getOptional(qp.Get("metricnames")) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) + timespanParam := getOptional(qp.Get("timespan")) + intervalParam := getOptional(qp.Get("interval")) + aggregationParam := getOptional(qp.Get("aggregation")) + sensitivitiesParam := getOptional(qp.Get("sensitivities")) + filterParam := getOptional(qp.Get("$filter")) + resultTypeParam := getOptional(armmonitor.ResultType(qp.Get("resultType"))) var options *armmonitor.BaselinesClientListOptions if metricnamesParam != nil || metricnamespaceParam != nil || timespanParam != nil || intervalParam != nil || aggregationParam != nil || sensitivitiesParam != nil || filterParam != nil || resultTypeParam != nil { options = &armmonitor.BaselinesClientListOptions{ @@ -139,12 +122,15 @@ func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*htt resp := b.srv.NewListPager(resourceURIParam, options) newListPager = &resp b.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.BaselinesClientListResponse, 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) { + if !slices.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)} } @@ -153,3 +139,9 @@ func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*htt } return resp, nil } + +// set this to conditionally intercept incoming requests to BaselinesServerTransport +var baselinesServerTransportInterceptor 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/datacollectionendpoints_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go index a5bbf8b0fce1..2239a1eba802 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,15 +15,15 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" "net/http" "net/url" - "reflect" "regexp" + "slices" ) // 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) + Create func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body armmonitor.DataCollectionEndpointResource, 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 @@ -34,6 +33,10 @@ type DataCollectionEndpointsServer struct { // 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) + // GetNSP is the fake for method DataCollectionEndpointsClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.DataCollectionEndpointsClientGetNSPOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientGetNSPResponse], 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]) @@ -42,9 +45,17 @@ type DataCollectionEndpointsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armmonitor.DataCollectionEndpointsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]) + // NewListNSPPager is the fake for method DataCollectionEndpointsClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method DataCollectionEndpointsClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.DataCollectionEndpointsClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse], errResp azfake.ErrorResponder) + // 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) + Update func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body armmonitor.ResourceForUpdate, options *armmonitor.DataCollectionEndpointsClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewDataCollectionEndpointsServerTransport creates a new instance of DataCollectionEndpointsServerTransport with the provided implementation. @@ -55,6 +66,8 @@ func NewDataCollectionEndpointsServerTransport(srv *DataCollectionEndpointsServe srv: srv, newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]](), + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse]](), } } @@ -64,6 +77,8 @@ type DataCollectionEndpointsServerTransport struct { srv *DataCollectionEndpointsServer newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]] + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.DataCollectionEndpointsClientReconcileNSPResponse]] } // Do implements the policy.Transporter interface for DataCollectionEndpointsServerTransport. @@ -74,41 +89,61 @@ func (d *DataCollectionEndpointsServerTransport) Do(req *http.Request) (*http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - 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) - } +func (d *DataCollectionEndpointsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if dataCollectionEndpointsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataCollectionEndpointsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataCollectionEndpointsClient.Create": + res.resp, res.err = d.dispatchCreate(req) + case "DataCollectionEndpointsClient.Delete": + res.resp, res.err = d.dispatchDelete(req) + case "DataCollectionEndpointsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataCollectionEndpointsClient.GetNSP": + res.resp, res.err = d.dispatchGetNSP(req) + case "DataCollectionEndpointsClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + case "DataCollectionEndpointsClient.NewListBySubscriptionPager": + res.resp, res.err = d.dispatchNewListBySubscriptionPager(req) + case "DataCollectionEndpointsClient.NewListNSPPager": + res.resp, res.err = d.dispatchNewListNSPPager(req) + case "DataCollectionEndpointsClient.BeginReconcileNSP": + res.resp, res.err = d.dispatchBeginReconcileNSP(req) + case "DataCollectionEndpointsClient.Update": + res.resp, res.err = d.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionEndpointResource](req) @@ -123,18 +158,12 @@ func (d *DataCollectionEndpointsServerTransport) dispatchCreate(req *http.Reques 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) + respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, 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) { + if !slices.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) @@ -148,10 +177,10 @@ func (d *DataCollectionEndpointsServerTransport) dispatchDelete(req *http.Reques 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -167,7 +196,7 @@ func (d *DataCollectionEndpointsServerTransport) dispatchDelete(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -181,10 +210,10 @@ func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -200,7 +229,7 @@ func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -210,16 +239,53 @@ func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) return resp, nil } +func (d *DataCollectionEndpointsServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if d.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP 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~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetNSP(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).NetworkSecurityPerimeterConfiguration, 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` + 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -237,7 +303,7 @@ func (d *DataCollectionEndpointsServerTransport) dispatchNewListByResourceGroupP if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -256,7 +322,7 @@ func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPa 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := d.srv.NewListBySubscriptionPager(nil) @@ -270,7 +336,7 @@ func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPa if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -280,14 +346,103 @@ func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPa return resp, nil } +func (d *DataCollectionEndpointsServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := d.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListNSPPager(resourceGroupNameParam, dataCollectionEndpointNameParam, nil) + newListNSPPager = &resp + d.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.DataCollectionEndpointsClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + d.newListNSPPager.remove(req) + } + return resp, nil +} + +func (d *DataCollectionEndpointsServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if d.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := d.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + d.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginReconcileNSP.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(beginReconcileNSP) { + d.beginReconcileNSP.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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) @@ -302,18 +457,12 @@ func (d *DataCollectionEndpointsServerTransport) dispatchUpdate(req *http.Reques 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) + respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -322,3 +471,9 @@ func (d *DataCollectionEndpointsServerTransport) dispatchUpdate(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to DataCollectionEndpointsServerTransport +var dataCollectionEndpointsServerTransportInterceptor 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/datacollectionruleassociations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go index 5a4ec6165a00..9b80bccd858b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,15 +15,16 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" "net/http" "net/url" - "reflect" "regexp" + "slices" + "strconv" ) // 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) + Create func(ctx context.Context, resourceURI string, associationName string, body armmonitor.DataCollectionRuleAssociationProxyOnlyResource, 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 @@ -76,31 +76,45 @@ func (d *DataCollectionRuleAssociationsServerTransport) Do(req *http.Request) (* return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - 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) - } +func (d *DataCollectionRuleAssociationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if dataCollectionRuleAssociationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataCollectionRuleAssociationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataCollectionRuleAssociationsClient.Create": + res.resp, res.err = d.dispatchCreate(req) + case "DataCollectionRuleAssociationsClient.Delete": + res.resp, res.err = d.dispatchDelete(req) + case "DataCollectionRuleAssociationsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager": + res.resp, res.err = d.dispatchNewListByDataCollectionEndpointPager(req) + case "DataCollectionRuleAssociationsClient.NewListByResourcePager": + res.resp, res.err = d.dispatchNewListByResourcePager(req) + case "DataCollectionRuleAssociationsClient.NewListByRulePager": + res.resp, res.err = d.dispatchNewListByRulePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataCollectionRuleAssociationsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -110,7 +124,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchCreate(req *http 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleAssociationProxyOnlyResource](req) @@ -125,18 +139,12 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchCreate(req *http 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) + respr, errRespr := d.srv.Create(req.Context(), resourceURIParam, associationNameParam, 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) { + if !slices.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) @@ -153,7 +161,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchDelete(req *http 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -169,7 +177,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchDelete(req *http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -186,7 +194,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchGet(req *http.Re 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -202,7 +210,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchGet(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -218,10 +226,10 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByDataCol } 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` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -243,7 +251,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByDataCol if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -262,7 +270,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByResourc 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -280,7 +288,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByResourc if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -296,12 +304,13 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePag } 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` + 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 { + if len(matches) < 4 { 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 @@ -310,7 +319,25 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePag if err != nil { return nil, err } - resp := d.srv.NewListByRulePager(resourceGroupNameParam, dataCollectionRuleNameParam, nil) + skipTokenParam := getOptional(qp.Get("$skipToken")) + topParam, err := parseOptional(qp.Get("$top"), 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 + } + var options *armmonitor.DataCollectionRuleAssociationsClientListByRuleOptions + if skipTokenParam != nil || topParam != nil { + options = &armmonitor.DataCollectionRuleAssociationsClientListByRuleOptions{ + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := d.srv.NewListByRulePager(resourceGroupNameParam, dataCollectionRuleNameParam, options) newListByRulePager = &resp d.newListByRulePager.add(req, newListByRulePager) server.PagerResponderInjectNextLinks(newListByRulePager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse, createLink func() string) { @@ -321,7 +348,7 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePag if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -330,3 +357,9 @@ func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePag } return resp, nil } + +// set this to conditionally intercept incoming requests to DataCollectionRuleAssociationsServerTransport +var dataCollectionRuleAssociationsServerTransportInterceptor 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/datacollectionrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go index bbd94c4024e1..5a50d15fbc06 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,15 +15,16 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" "net/http" "net/url" - "reflect" "regexp" + "slices" + "strconv" ) // 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) + Create func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body armmonitor.DataCollectionRuleResource, 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 @@ -44,7 +44,7 @@ type DataCollectionRulesServer struct { // 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) + Update func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body armmonitor.ResourceForUpdate, options *armmonitor.DataCollectionRulesClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewDataCollectionRulesServerTransport creates a new instance of DataCollectionRulesServerTransport with the provided implementation. @@ -74,41 +74,55 @@ func (d *DataCollectionRulesServerTransport) 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 d.dispatchToMethodFake(req, method) +} - 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) - } +func (d *DataCollectionRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if dataCollectionRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataCollectionRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataCollectionRulesClient.Create": + res.resp, res.err = d.dispatchCreate(req) + case "DataCollectionRulesClient.Delete": + res.resp, res.err = d.dispatchDelete(req) + case "DataCollectionRulesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataCollectionRulesClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + case "DataCollectionRulesClient.NewListBySubscriptionPager": + res.resp, res.err = d.dispatchNewListBySubscriptionPager(req) + case "DataCollectionRulesClient.Update": + res.resp, res.err = d.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleResource](req) @@ -123,18 +137,12 @@ func (d *DataCollectionRulesServerTransport) dispatchCreate(req *http.Request) ( 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) + respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, 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) { + if !slices.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) @@ -148,12 +156,13 @@ func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) ( 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~%@]+)` + 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 { + if len(matches) < 4 { 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 @@ -162,12 +171,22 @@ func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) ( if err != nil { return nil, err } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) + deleteAssociationsParam, err := parseOptional(qp.Get("deleteAssociations"), strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armmonitor.DataCollectionRulesClientDeleteOptions + if deleteAssociationsParam != nil { + options = &armmonitor.DataCollectionRulesClientDeleteOptions{ + DeleteAssociations: deleteAssociationsParam, + } + } + respr, errRespr := d.srv.Delete(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.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -181,10 +200,10 @@ func (d *DataCollectionRulesServerTransport) dispatchGet(req *http.Request) (*ht 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -200,7 +219,7 @@ func (d *DataCollectionRulesServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -216,10 +235,10 @@ func (d *DataCollectionRulesServerTransport) dispatchNewListByResourceGroupPager } 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` + 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -237,7 +256,7 @@ func (d *DataCollectionRulesServerTransport) dispatchNewListByResourceGroupPager if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -256,7 +275,7 @@ func (d *DataCollectionRulesServerTransport) dispatchNewListBySubscriptionPager( 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := d.srv.NewListBySubscriptionPager(nil) @@ -270,7 +289,7 @@ func (d *DataCollectionRulesServerTransport) dispatchNewListBySubscriptionPager( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -284,10 +303,10 @@ func (d *DataCollectionRulesServerTransport) dispatchUpdate(req *http.Request) ( 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) @@ -302,18 +321,12 @@ func (d *DataCollectionRulesServerTransport) dispatchUpdate(req *http.Request) ( 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) + respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -322,3 +335,9 @@ func (d *DataCollectionRulesServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to DataCollectionRulesServerTransport +var dataCollectionRulesServerTransportInterceptor 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/diagnosticsettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go deleted file mode 100644 index fa4e79d4a87e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 07b3abf551b4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 index f420d1e9172e..84b519da21db 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,8 +10,10 @@ import ( 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" + "slices" ) // EventCategoriesServer is a fake server for instances of the armmonitor.EventCategoriesClient type. @@ -47,21 +48,35 @@ func (e *EventCategoriesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EventCategoriesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EventCategoriesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if eventCategoriesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = eventCategoriesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EventCategoriesClient.NewListPager": + res.resp, res.err = e.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *EventCategoriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -73,12 +88,15 @@ func (e *EventCategoriesServerTransport) dispatchNewListPager(req *http.Request) resp := e.srv.NewListPager(nil) newListPager = &resp e.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.EventCategoriesClientListResponse, 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) { + if !slices.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)} } @@ -87,3 +105,9 @@ func (e *EventCategoriesServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to EventCategoriesServerTransport +var eventCategoriesServerTransportInterceptor 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/internal.go b/sdk/resourcemanager/monitor/armmonitor/fake/internal.go index e786e01dd37e..504fffe54caa 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/internal.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/internal.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -20,23 +24,6 @@ func (nonRetriableError) NonRetriable() { // marker method } -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - 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 @@ -44,6 +31,14 @@ func getOptional[T any](v T) *T { return &v } +func initServer[T any](mu *sync.Mutex, dst **T, src func() *T) { + mu.Lock() + if *dst == nil { + *dst = src() + } + mu.Unlock() +} + func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { if v == "" { return nil, nil @@ -52,7 +47,7 @@ func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) if err != nil { return nil, err } - return &t, err + return &t, nil } func newTracker[T any]() *tracker[T] { diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go index 04820f937bd5..20c43bd318c4 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( 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" + "slices" ) // LogProfilesServer is a fake server for instances of the armmonitor.LogProfilesClient type. @@ -66,29 +67,43 @@ func (l *LogProfilesServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return l.dispatchToMethodFake(req, method) +} - 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) - } +func (l *LogProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if logProfilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = logProfilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LogProfilesClient.CreateOrUpdate": + res.resp, res.err = l.dispatchCreateOrUpdate(req) + case "LogProfilesClient.Delete": + res.resp, res.err = l.dispatchDelete(req) + case "LogProfilesClient.Get": + res.resp, res.err = l.dispatchGet(req) + case "LogProfilesClient.NewListPager": + res.resp, res.err = l.dispatchNewListPager(req) + case "LogProfilesClient.Update": + res.resp, res.err = l.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (l *LogProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -98,7 +113,7 @@ func (l *LogProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) ( 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResource](req) @@ -114,7 +129,7 @@ func (l *LogProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -131,7 +146,7 @@ func (l *LogProfilesServerTransport) dispatchDelete(req *http.Request) (*http.Re 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) @@ -143,7 +158,7 @@ func (l *LogProfilesServerTransport) dispatchDelete(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -160,7 +175,7 @@ func (l *LogProfilesServerTransport) dispatchGet(req *http.Request) (*http.Respo 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) @@ -172,7 +187,7 @@ func (l *LogProfilesServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -191,18 +206,21 @@ func (l *LogProfilesServerTransport) dispatchNewListPager(req *http.Request) (*h 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := l.srv.NewListPager(nil) newListPager = &resp l.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.LogProfilesClientListResponse, 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) { + if !slices.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)} } @@ -219,7 +237,7 @@ func (l *LogProfilesServerTransport) dispatchUpdate(req *http.Request) (*http.Re 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResourcePatch](req) @@ -235,7 +253,7 @@ func (l *LogProfilesServerTransport) dispatchUpdate(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -244,3 +262,9 @@ func (l *LogProfilesServerTransport) dispatchUpdate(req *http.Request) (*http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to LogProfilesServerTransport +var logProfilesServerTransportInterceptor 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/metricalerts_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go index 535ce02acd10..ef29f504c556 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( 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" + "slices" ) // MetricAlertsServer is a fake server for instances of the armmonitor.MetricAlertsClient type. @@ -72,41 +73,55 @@ func (m *MetricAlertsServerTransport) 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 + return m.dispatchToMethodFake(req, method) +} - 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) - } +func (m *MetricAlertsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if metricAlertsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = metricAlertsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MetricAlertsClient.CreateOrUpdate": + res.resp, res.err = m.dispatchCreateOrUpdate(req) + case "MetricAlertsClient.Delete": + res.resp, res.err = m.dispatchDelete(req) + case "MetricAlertsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MetricAlertsClient.NewListByResourceGroupPager": + res.resp, res.err = m.dispatchNewListByResourceGroupPager(req) + case "MetricAlertsClient.NewListBySubscriptionPager": + res.resp, res.err = m.dispatchNewListBySubscriptionPager(req) + case "MetricAlertsClient.Update": + res.resp, res.err = m.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResource](req) @@ -126,7 +141,7 @@ func (m *MetricAlertsServerTransport) dispatchCreateOrUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -140,10 +155,10 @@ func (m *MetricAlertsServerTransport) dispatchDelete(req *http.Request) (*http.R 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -159,7 +174,7 @@ func (m *MetricAlertsServerTransport) dispatchDelete(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -173,10 +188,10 @@ func (m *MetricAlertsServerTransport) dispatchGet(req *http.Request) (*http.Resp 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -192,7 +207,7 @@ func (m *MetricAlertsServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -208,10 +223,10 @@ func (m *MetricAlertsServerTransport) dispatchNewListByResourceGroupPager(req *h } 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` + 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,12 +236,15 @@ func (m *MetricAlertsServerTransport) dispatchNewListByResourceGroupPager(req *h resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.MetricAlertsClientListByResourceGroupResponse, 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) { + if !slices.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)} } @@ -245,18 +263,21 @@ func (m *MetricAlertsServerTransport) dispatchNewListBySubscriptionPager(req *ht 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := m.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp m.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.MetricAlertsClientListBySubscriptionResponse, 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) { + if !slices.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)} } @@ -270,10 +291,10 @@ func (m *MetricAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.R 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResourcePatch](req) @@ -293,7 +314,7 @@ func (m *MetricAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -302,3 +323,9 @@ func (m *MetricAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to MetricAlertsServerTransport +var metricAlertsServerTransportInterceptor 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/metricalertsstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go index 435a6fb706dd..0907d8d148e3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // MetricAlertsStatusServer is a fake server for instances of the armmonitor.MetricAlertsStatusClient type. @@ -50,33 +50,47 @@ func (m *MetricAlertsStatusServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - 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) - } +func (m *MetricAlertsStatusServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if metricAlertsStatusServerTransportInterceptor != nil { + res.resp, res.err, intercepted = metricAlertsStatusServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MetricAlertsStatusClient.List": + res.resp, res.err = m.dispatchList(req) + case "MetricAlertsStatusClient.ListByName": + res.resp, res.err = m.dispatchListByName(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -92,7 +106,7 @@ func (m *MetricAlertsStatusServerTransport) dispatchList(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -109,7 +123,7 @@ func (m *MetricAlertsStatusServerTransport) dispatchListByName(req *http.Request 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -129,7 +143,7 @@ func (m *MetricAlertsStatusServerTransport) dispatchListByName(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -138,3 +152,9 @@ func (m *MetricAlertsStatusServerTransport) dispatchListByName(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to MetricAlertsStatusServerTransport +var metricAlertsStatusServerTransportInterceptor 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/metricdefinitions_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go index 7e6c46373963..2d44fbc9fe44 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,10 +10,12 @@ import ( 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" + "slices" ) // MetricDefinitionsServer is a fake server for instances of the armmonitor.MetricDefinitionsClient type. @@ -55,23 +56,37 @@ func (m *MetricDefinitionsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - 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) - } +func (m *MetricDefinitionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if metricDefinitionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = metricDefinitionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MetricDefinitionsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "MetricDefinitionsClient.NewListAtSubscriptionScopePager": + res.resp, res.err = m.dispatchNewListAtSubscriptionScopePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -83,7 +98,7 @@ func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Reques 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -91,11 +106,7 @@ func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) var options *armmonitor.MetricDefinitionsClientListOptions if metricnamespaceParam != nil { options = &armmonitor.MetricDefinitionsClientListOptions{ @@ -105,12 +116,15 @@ func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Reques resp := m.srv.NewListPager(resourceURIParam, options) newListPager = &resp m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.MetricDefinitionsClientListResponse, 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) { + if !slices.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)} } @@ -129,34 +143,29 @@ func (m *MetricDefinitionsServerTransport) dispatchNewListAtSubscriptionScopePag 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 { + if len(matches) < 2 { 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) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) var options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions if metricnamespaceParam != nil { options = &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{ Metricnamespace: metricnamespaceParam, } } - resp := m.srv.NewListAtSubscriptionScopePager(regionParam, options) + resp := m.srv.NewListAtSubscriptionScopePager(qp.Get("region"), options) newListAtSubscriptionScopePager = &resp m.newListAtSubscriptionScopePager.add(req, newListAtSubscriptionScopePager) + server.PagerResponderInjectNextLinks(newListAtSubscriptionScopePager, req, func(page *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListAtSubscriptionScopePager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -165,3 +174,9 @@ func (m *MetricDefinitionsServerTransport) dispatchNewListAtSubscriptionScopePag } return resp, nil } + +// set this to conditionally intercept incoming requests to MetricDefinitionsServerTransport +var metricDefinitionsServerTransportInterceptor 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/metricnamespaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go index fbf8cdc3ecfe..71f51894433e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,10 +10,12 @@ import ( 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" + "slices" ) // MetricNamespacesServer is a fake server for instances of the armmonitor.MetricNamespacesClient type. @@ -49,21 +50,35 @@ func (m *MetricNamespacesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "MetricNamespacesClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *MetricNamespacesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if metricNamespacesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = metricNamespacesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MetricNamespacesClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -75,7 +90,7 @@ func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -83,11 +98,7 @@ func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - startTimeUnescaped, err := url.QueryUnescape(qp.Get("startTime")) - if err != nil { - return nil, err - } - startTimeParam := getOptional(startTimeUnescaped) + startTimeParam := getOptional(qp.Get("startTime")) var options *armmonitor.MetricNamespacesClientListOptions if startTimeParam != nil { options = &armmonitor.MetricNamespacesClientListOptions{ @@ -97,12 +108,15 @@ func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request resp := m.srv.NewListPager(resourceURIParam, options) newListPager = &resp m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.MetricNamespacesClientListResponse, 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) { + if !slices.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)} } @@ -111,3 +125,9 @@ func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to MetricNamespacesServerTransport +var metricNamespacesServerTransportInterceptor 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/metrics_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go index 02adddbd033a..e644175fb1a2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/url" "reflect" "regexp" + "slices" "strconv" ) @@ -56,25 +56,39 @@ func (m *MetricsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - 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) - } +func (m *MetricsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if metricsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = metricsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MetricsClient.List": + res.resp, res.err = m.dispatchList(req) + case "MetricsClient.ListAtSubscriptionScope": + res.resp, res.err = m.dispatchListAtSubscriptionScope(req) + case "MetricsClient.ListAtSubscriptionScopePost": + res.resp, res.err = m.dispatchListAtSubscriptionScopePost(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { @@ -84,7 +98,7 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -92,31 +106,11 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response 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) { + timespanParam := getOptional(qp.Get("timespan")) + intervalParam := getOptional(qp.Get("interval")) + metricnamesParam := getOptional(qp.Get("metricnames")) + aggregationParam := getOptional(qp.Get("aggregation")) + topParam, err := parseOptional(qp.Get("top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -126,44 +120,21 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response 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")) + orderbyParam := getOptional(qp.Get("orderby")) + filterParam := getOptional(qp.Get("$filter")) + resultTypeParam := getOptional(armmonitor.ResultType(qp.Get("resultType"))) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) + autoAdjustTimegrainParam, err := parseOptional(qp.Get("AutoAdjustTimegrain"), strconv.ParseBool) 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) + validateDimensionsParam, err := parseOptional(qp.Get("ValidateDimensions"), strconv.ParseBool) if err != nil { return nil, err } + rollupbyParam := getOptional(qp.Get("rollupby")) 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 { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil { options = &armmonitor.MetricsClientListOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -176,6 +147,7 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, } } respr, errRespr := m.srv.List(req.Context(), resourceURIParam, options) @@ -183,7 +155,7 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -200,39 +172,15 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque 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 { + if len(matches) < 2 { 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) { + timespanParam := getOptional(qp.Get("timespan")) + intervalParam := getOptional(qp.Get("interval")) + metricnamesParam := getOptional(qp.Get("metricnames")) + aggregationParam := getOptional(qp.Get("aggregation")) + topParam, err := parseOptional(qp.Get("top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -242,44 +190,21 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque 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")) + orderbyParam := getOptional(qp.Get("orderby")) + filterParam := getOptional(qp.Get("$filter")) + resultTypeParam := getOptional(armmonitor.MetricResultType(qp.Get("resultType"))) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) + autoAdjustTimegrainParam, err := parseOptional(qp.Get("AutoAdjustTimegrain"), strconv.ParseBool) if err != nil { return nil, err } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) + validateDimensionsParam, err := parseOptional(qp.Get("ValidateDimensions"), strconv.ParseBool) if err != nil { return nil, err } + rollupbyParam := getOptional(qp.Get("rollupby")) 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 { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil { options = &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -292,17 +217,18 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, } } - respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionParam, options) + respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), qp.Get("region"), options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } @@ -316,7 +242,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -324,35 +250,11 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R 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) { + timespanParam := getOptional(qp.Get("timespan")) + intervalParam := getOptional(qp.Get("interval")) + metricnamesParam := getOptional(qp.Get("metricnames")) + aggregationParam := getOptional(qp.Get("aggregation")) + topParam, err := parseOptional(qp.Get("top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -362,44 +264,21 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R if err != nil { return nil, err } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) + orderbyParam := getOptional(qp.Get("orderby")) + filterParam := getOptional(qp.Get("$filter")) + resultTypeParam := getOptional(armmonitor.MetricResultType(qp.Get("resultType"))) + metricnamespaceParam := getOptional(qp.Get("metricnamespace")) + autoAdjustTimegrainParam, err := parseOptional(qp.Get("AutoAdjustTimegrain"), strconv.ParseBool) 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) + validateDimensionsParam, err := parseOptional(qp.Get("ValidateDimensions"), strconv.ParseBool) if err != nil { return nil, err } + rollupbyParam := getOptional(qp.Get("rollupby")) 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() { + if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || rollupbyParam != nil || !reflect.ValueOf(body).IsZero() { options = &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ Timespan: timespanParam, Interval: intervalParam, @@ -412,20 +291,27 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, Body: &body, } } - respr, errRespr := m.srv.ListAtSubscriptionScopePost(req.Context(), regionParam, options) + respr, errRespr := m.srv.ListAtSubscriptionScopePost(req.Context(), qp.Get("region"), options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } return resp, nil } + +// set this to conditionally intercept incoming requests to MetricsServerTransport +var metricsServerTransportInterceptor 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/operations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go deleted file mode 100644 index 51396ee9299a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 a707731a4978..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 index 85616252036f..82dff7a18122 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PredictiveMetricServer is a fake server for instances of the armmonitor.PredictiveMetricClient type. @@ -46,21 +46,35 @@ func (p *PredictiveMetricServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PredictiveMetricClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PredictiveMetricServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if predictiveMetricServerTransportInterceptor != nil { + res.resp, res.err, intercepted = predictiveMetricServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PredictiveMetricClient.Get": + res.resp, res.err = p.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -70,7 +84,7 @@ func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http. 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -82,32 +96,12 @@ func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http. 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) + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, qp.Get("timespan"), qp.Get("interval"), qp.Get("metricNamespace"), qp.Get("metricName"), qp.Get("aggregation"), nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -116,3 +110,9 @@ func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to PredictiveMetricServerTransport +var predictiveMetricServerTransportInterceptor 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/privateendpointconnections_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go index 732b98d6536b..a4b17b7b045a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateEndpointConnectionsServer is a fake server for instances of the armmonitor.PrivateEndpointConnectionsClient type. @@ -64,27 +64,41 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - 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) - } +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.ListByPrivateLinkScope": + res.resp, res.err = p.dispatchListByPrivateLinkScope(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -93,10 +107,10 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( } 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnection](req) @@ -128,7 +142,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.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)} } @@ -145,10 +159,10 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt } 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -176,7 +190,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -191,10 +205,10 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -214,7 +228,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -228,10 +242,10 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchListByPrivateLinkSco 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` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -247,7 +261,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchListByPrivateLinkSco return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -256,3 +270,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchListByPrivateLinkSco } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor 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/privatelinkresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go index 4599c6818e0f..73831caf921d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateLinkResourcesServer is a fake server for instances of the armmonitor.PrivateLinkResourcesClient type. @@ -50,33 +50,47 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - 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) - } +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.ListByPrivateLinkScope": + res.resp, res.err = p.dispatchListByPrivateLinkScope(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -96,7 +110,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -110,10 +124,10 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByPrivateLinkScope(req 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` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -129,7 +143,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByPrivateLinkScope(req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -138,3 +152,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByPrivateLinkScope(req } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor 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/privatelinkscopedresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go index 9172110186fa..4da962f796de 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateLinkScopedResourcesServer is a fake server for instances of the armmonitor.PrivateLinkScopedResourcesClient type. @@ -67,27 +67,41 @@ func (p *PrivateLinkScopedResourcesServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - 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) - } +func (p *PrivateLinkScopedResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkScopedResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkScopedResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkScopedResourcesClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateLinkScopedResourcesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateLinkScopedResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager": + res.resp, res.err = p.dispatchNewListByPrivateLinkScopePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -96,10 +110,10 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginCreateOrUpdate( } 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ScopedResource](req) @@ -131,7 +145,7 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginCreateOrUpdate( return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.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)} } @@ -148,10 +162,10 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginDelete(req *htt } 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -179,7 +193,7 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -194,10 +208,10 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchGet(req *http.Reques 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~%@]+)` + 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -217,7 +231,7 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchGet(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -233,12 +247,13 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLink } 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` + 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 { + if len(matches) < 4 { 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 @@ -247,7 +262,14 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLink if err != nil { return nil, err } - resp := p.srv.NewListByPrivateLinkScopePager(resourceGroupNameParam, scopeNameParam, nil) + kindParam := getOptional(qp.Get("kind")) + var options *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions + if kindParam != nil { + options = &armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions{ + Kind: kindParam, + } + } + resp := p.srv.NewListByPrivateLinkScopePager(resourceGroupNameParam, scopeNameParam, options) newListByPrivateLinkScopePager = &resp p.newListByPrivateLinkScopePager.add(req, newListByPrivateLinkScopePager) server.PagerResponderInjectNextLinks(newListByPrivateLinkScopePager, req, func(page *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, createLink func() string) { @@ -258,7 +280,7 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLink if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -267,3 +289,9 @@ func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLink } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkScopedResourcesServerTransport +var privateLinkScopedResourcesServerTransportInterceptor 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/privatelinkscopeoperationstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go index 80c56c9576af..fb807e72c649 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,13 +15,14 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // 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) + Get func(ctx context.Context, resourceGroupName string, asyncOperationID string, options *armmonitor.PrivateLinkScopeOperationStatusClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopeOperationStatusClientGetResponse], errResp azfake.ErrorResponder) } // NewPrivateLinkScopeOperationStatusServerTransport creates a new instance of PrivateLinkScopeOperationStatusServerTransport with the provided implementation. @@ -46,47 +46,61 @@ func (p *PrivateLinkScopeOperationStatusServerTransport) Do(req *http.Request) ( return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkScopeOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkScopeOperationStatusServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkScopeOperationStatusServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkScopeOperationStatusServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkScopeOperationStatusClient.Get": + res.resp, res.err = p.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) if err != nil { return nil, err } - respr, errRespr := p.srv.Get(req.Context(), asyncOperationIDParam, resourceGroupNameParam, nil) + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, asyncOperationIDParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -95,3 +109,9 @@ func (p *PrivateLinkScopeOperationStatusServerTransport) dispatchGet(req *http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkScopeOperationStatusServerTransport +var privateLinkScopeOperationStatusServerTransportInterceptor 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/privatelinkscopes_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go index b34cf77fb0a7..32b397b54146 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateLinkScopesServer is a fake server for instances of the armmonitor.PrivateLinkScopesClient type. @@ -75,41 +75,55 @@ func (p *PrivateLinkScopesServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - 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) - } +func (p *PrivateLinkScopesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkScopesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkScopesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkScopesClient.CreateOrUpdate": + res.resp, res.err = p.dispatchCreateOrUpdate(req) + case "PrivateLinkScopesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateLinkScopesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkScopesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateLinkScopesClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PrivateLinkScopesClient.UpdateTags": + res.resp, res.err = p.dispatchUpdateTags(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorPrivateLinkScope](req) @@ -129,7 +143,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchCreateOrUpdate(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.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) @@ -145,10 +159,10 @@ func (p *PrivateLinkScopesServerTransport) dispatchBeginDelete(req *http.Request } 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -172,7 +186,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchBeginDelete(req *http.Request return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -187,10 +201,10 @@ func (p *PrivateLinkScopesServerTransport) dispatchGet(req *http.Request) (*http 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -206,7 +220,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -222,10 +236,10 @@ func (p *PrivateLinkScopesServerTransport) dispatchNewListPager(req *http.Reques } newListPager := p.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes` + 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := p.srv.NewListPager(nil) @@ -239,7 +253,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -255,10 +269,10 @@ func (p *PrivateLinkScopesServerTransport) dispatchNewListByResourceGroupPager(r } 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` + 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -276,7 +290,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchNewListByResourceGroupPager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -290,10 +304,10 @@ func (p *PrivateLinkScopesServerTransport) dispatchUpdateTags(req *http.Request) 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~%@]+)` + 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.TagsResource](req) @@ -313,7 +327,7 @@ func (p *PrivateLinkScopesServerTransport) dispatchUpdateTags(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -322,3 +336,9 @@ func (p *PrivateLinkScopesServerTransport) dispatchUpdateTags(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkScopesServerTransport +var privateLinkScopesServerTransportInterceptor 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/scheduledqueryrule_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go new file mode 100644 index 000000000000..7c22d72234ef --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrule_server.go @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +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" + "slices" +) + +// ScheduledQueryRuleServer is a fake server for instances of the armmonitor.ScheduledQueryRuleClient type. +type ScheduledQueryRuleServer struct { + // GetNSP is the fake for method ScheduledQueryRuleClient.GetNSP + // HTTP status codes to indicate success: http.StatusOK + GetNSP func(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ScheduledQueryRuleClientGetNSPOptions) (resp azfake.Responder[armmonitor.ScheduledQueryRuleClientGetNSPResponse], errResp azfake.ErrorResponder) + + // NewListNSPPager is the fake for method ScheduledQueryRuleClient.NewListNSPPager + // HTTP status codes to indicate success: http.StatusOK + NewListNSPPager func(resourceGroupName string, ruleName string, options *armmonitor.ScheduledQueryRuleClientListNSPOptions) (resp azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]) + + // BeginReconcileNSP is the fake for method ScheduledQueryRuleClient.BeginReconcileNSP + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginReconcileNSP func(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *armmonitor.ScheduledQueryRuleClientBeginReconcileNSPOptions) (resp azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse], errResp azfake.ErrorResponder) +} + +// NewScheduledQueryRuleServerTransport creates a new instance of ScheduledQueryRuleServerTransport with the provided implementation. +// The returned ScheduledQueryRuleServerTransport instance is connected to an instance of armmonitor.ScheduledQueryRuleClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewScheduledQueryRuleServerTransport(srv *ScheduledQueryRuleServer) *ScheduledQueryRuleServerTransport { + return &ScheduledQueryRuleServerTransport{ + srv: srv, + newListNSPPager: newTracker[azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]](), + beginReconcileNSP: newTracker[azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse]](), + } +} + +// ScheduledQueryRuleServerTransport connects instances of armmonitor.ScheduledQueryRuleClient to instances of ScheduledQueryRuleServer. +// Don't use this type directly, use NewScheduledQueryRuleServerTransport instead. +type ScheduledQueryRuleServerTransport struct { + srv *ScheduledQueryRuleServer + newListNSPPager *tracker[azfake.PagerResponder[armmonitor.ScheduledQueryRuleClientListNSPResponse]] + beginReconcileNSP *tracker[azfake.PollerResponder[armmonitor.ScheduledQueryRuleClientReconcileNSPResponse]] +} + +// Do implements the policy.Transporter interface for ScheduledQueryRuleServerTransport. +func (s *ScheduledQueryRuleServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *ScheduledQueryRuleServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if scheduledQueryRuleServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scheduledQueryRuleServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScheduledQueryRuleClient.GetNSP": + res.resp, res.err = s.dispatchGetNSP(req) + case "ScheduledQueryRuleClient.NewListNSPPager": + res.resp, res.err = s.dispatchNewListNSPPager(req) + case "ScheduledQueryRuleClient.BeginReconcileNSP": + res.resp, res.err = s.dispatchBeginReconcileNSP(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *ScheduledQueryRuleServerTransport) dispatchGetNSP(req *http.Request) (*http.Response, error) { + if s.srv.GetNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method GetNSP not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetNSP(req.Context(), resourceGroupNameParam, ruleNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ScheduledQueryRuleServerTransport) dispatchNewListNSPPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListNSPPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListNSPPager not implemented")} + } + newListNSPPager := s.newListNSPPager.get(req) + if newListNSPPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := s.srv.NewListNSPPager(resourceGroupNameParam, ruleNameParam, nil) + newListNSPPager = &resp + s.newListNSPPager.add(req, newListNSPPager) + server.PagerResponderInjectNextLinks(newListNSPPager, req, func(page *armmonitor.ScheduledQueryRuleClientListNSPResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListNSPPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListNSPPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListNSPPager) { + s.newListNSPPager.remove(req) + } + return resp, nil +} + +func (s *ScheduledQueryRuleServerTransport) dispatchBeginReconcileNSP(req *http.Request) (*http.Response, error) { + if s.srv.BeginReconcileNSP == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcileNSP not implemented")} + } + beginReconcileNSP := s.beginReconcileNSP.get(req) + if beginReconcileNSP == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginReconcileNSP(req.Context(), resourceGroupNameParam, ruleNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcileNSP = &respr + s.beginReconcileNSP.add(req, beginReconcileNSP) + } + + resp, err := server.PollerResponderNext(beginReconcileNSP, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginReconcileNSP.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(beginReconcileNSP) { + s.beginReconcileNSP.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ScheduledQueryRuleServerTransport +var scheduledQueryRuleServerTransportInterceptor 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/scheduledqueryrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go index b98a706a1927..2576bfec90d0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ScheduledQueryRulesServer is a fake server for instances of the armmonitor.ScheduledQueryRulesClient type. @@ -73,41 +73,55 @@ 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, 1) + 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) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + 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) { if s.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/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ScheduledQueryRuleResource](req) @@ -127,7 +141,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchCreateOrUpdate(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.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).ScheduledQueryRuleResource, req) @@ -141,10 +155,10 @@ func (s *ScheduledQueryRulesServerTransport) dispatchDelete(req *http.Request) ( if s.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/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -160,7 +174,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchDelete(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -174,10 +188,10 @@ func (s *ScheduledQueryRulesServerTransport) dispatchGet(req *http.Request) (*ht if s.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/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -193,7 +207,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ScheduledQueryRuleResource, req) @@ -209,10 +223,10 @@ func (s *ScheduledQueryRulesServerTransport) dispatchNewListByResourceGroupPager } newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,7 +244,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchNewListByResourceGroupPager if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -249,7 +263,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -263,7 +277,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchNewListBySubscriptionPager( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -277,10 +291,10 @@ func (s *ScheduledQueryRulesServerTransport) dispatchUpdate(req *http.Request) ( if s.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/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/scheduledQueryRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmonitor.ScheduledQueryRuleResourcePatch](req) @@ -300,7 +314,7 @@ func (s *ScheduledQueryRulesServerTransport) dispatchUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ScheduledQueryRuleResource, req) @@ -309,3 +323,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 8aba7f8b42a7..acf344359ac4 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,38 +15,83 @@ 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 + // ActionGroupsServer contains the fakes for client ActionGroupsClient + ActionGroupsServer ActionGroupsServer + + // ActivityLogAlertsServer contains the fakes for client ActivityLogAlertsClient + ActivityLogAlertsServer ActivityLogAlertsServer + + // ActivityLogsServer contains the fakes for client ActivityLogsClient + ActivityLogsServer ActivityLogsServer + + // AlertRuleIncidentsServer contains the fakes for client AlertRuleIncidentsClient + AlertRuleIncidentsServer AlertRuleIncidentsServer + + // AutoscaleSettingsServer contains the fakes for client AutoscaleSettingsClient + AutoscaleSettingsServer AutoscaleSettingsServer + + // BaselinesServer contains the fakes for client BaselinesClient + BaselinesServer BaselinesServer + + // DataCollectionEndpointsServer contains the fakes for client DataCollectionEndpointsClient + DataCollectionEndpointsServer DataCollectionEndpointsServer + + // DataCollectionRuleAssociationsServer contains the fakes for client DataCollectionRuleAssociationsClient + DataCollectionRuleAssociationsServer DataCollectionRuleAssociationsServer + + // DataCollectionRulesServer contains the fakes for client DataCollectionRulesClient + DataCollectionRulesServer DataCollectionRulesServer + + // EventCategoriesServer contains the fakes for client EventCategoriesClient + EventCategoriesServer EventCategoriesServer + + // LogProfilesServer contains the fakes for client LogProfilesClient + LogProfilesServer LogProfilesServer + + // MetricAlertsServer contains the fakes for client MetricAlertsClient + MetricAlertsServer MetricAlertsServer + + // MetricAlertsStatusServer contains the fakes for client MetricAlertsStatusClient + MetricAlertsStatusServer MetricAlertsStatusServer + + // MetricDefinitionsServer contains the fakes for client MetricDefinitionsClient + MetricDefinitionsServer MetricDefinitionsServer + + // MetricNamespacesServer contains the fakes for client MetricNamespacesClient + MetricNamespacesServer MetricNamespacesServer + + // MetricsServer contains the fakes for client MetricsClient + MetricsServer MetricsServer + + // PredictiveMetricServer contains the fakes for client PredictiveMetricClient + PredictiveMetricServer PredictiveMetricServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // PrivateLinkScopeOperationStatusServer contains the fakes for client PrivateLinkScopeOperationStatusClient PrivateLinkScopeOperationStatusServer PrivateLinkScopeOperationStatusServer - PrivateLinkScopedResourcesServer PrivateLinkScopedResourcesServer - PrivateLinkScopesServer PrivateLinkScopesServer - ScheduledQueryRulesServer ScheduledQueryRulesServer - TenantActionGroupsServer TenantActionGroupsServer - TenantActivityLogsServer TenantActivityLogsServer - VMInsightsServer VMInsightsServer + + // PrivateLinkScopedResourcesServer contains the fakes for client PrivateLinkScopedResourcesClient + PrivateLinkScopedResourcesServer PrivateLinkScopedResourcesServer + + // PrivateLinkScopesServer contains the fakes for client PrivateLinkScopesClient + PrivateLinkScopesServer PrivateLinkScopesServer + + // ScheduledQueryRuleServer contains the fakes for client ScheduledQueryRuleClient + ScheduledQueryRuleServer ScheduledQueryRuleServer + + // ScheduledQueryRulesServer contains the fakes for client ScheduledQueryRulesClient + ScheduledQueryRulesServer ScheduledQueryRulesServer + + // ServiceDiagnosticSettingsServer contains the fakes for client ServiceDiagnosticSettingsClient + ServiceDiagnosticSettingsServer ServiceDiagnosticSettingsServer + + // TenantActivityLogsServer contains the fakes for client TenantActivityLogsClient + TenantActivityLogsServer TenantActivityLogsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -68,15 +112,11 @@ type ServerFactoryTransport struct { 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 @@ -84,18 +124,16 @@ type ServerFactoryTransport struct { trMetricDefinitionsServer *MetricDefinitionsServerTransport trMetricNamespacesServer *MetricNamespacesServerTransport trMetricsServer *MetricsServerTransport - trOperationsServer *OperationsServerTransport - trOperationsForMonitorServer *OperationsForMonitorServerTransport trPredictiveMetricServer *PredictiveMetricServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport trPrivateLinkScopeOperationStatusServer *PrivateLinkScopeOperationStatusServerTransport trPrivateLinkScopedResourcesServer *PrivateLinkScopedResourcesServerTransport trPrivateLinkScopesServer *PrivateLinkScopesServerTransport + trScheduledQueryRuleServer *ScheduledQueryRuleServerTransport trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport - trTenantActionGroupsServer *TenantActionGroupsServerTransport + trServiceDiagnosticSettingsServer *ServiceDiagnosticSettingsServerTransport trTenantActivityLogsServer *TenantActivityLogsServerTransport - trVMInsightsServer *VMInsightsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -112,147 +150,123 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "ActionGroupsClient": - initServer(s, &s.trActionGroupsServer, func() *ActionGroupsServerTransport { return NewActionGroupsServerTransport(&s.srv.ActionGroupsServer) }) + initServer(&s.trMu, &s.trActionGroupsServer, func() *ActionGroupsServerTransport { return NewActionGroupsServerTransport(&s.srv.ActionGroupsServer) }) resp, err = s.trActionGroupsServer.Do(req) case "ActivityLogAlertsClient": - initServer(s, &s.trActivityLogAlertsServer, func() *ActivityLogAlertsServerTransport { + initServer(&s.trMu, &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) }) + initServer(&s.trMu, &s.trActivityLogsServer, func() *ActivityLogsServerTransport { return NewActivityLogsServerTransport(&s.srv.ActivityLogsServer) }) resp, err = s.trActivityLogsServer.Do(req) case "AlertRuleIncidentsClient": - initServer(s, &s.trAlertRuleIncidentsServer, func() *AlertRuleIncidentsServerTransport { + initServer(&s.trMu, &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 { + initServer(&s.trMu, &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) }) + initServer(&s.trMu, &s.trBaselinesServer, func() *BaselinesServerTransport { return NewBaselinesServerTransport(&s.srv.BaselinesServer) }) resp, err = s.trBaselinesServer.Do(req) case "DataCollectionEndpointsClient": - initServer(s, &s.trDataCollectionEndpointsServer, func() *DataCollectionEndpointsServerTransport { + initServer(&s.trMu, &s.trDataCollectionEndpointsServer, func() *DataCollectionEndpointsServerTransport { return NewDataCollectionEndpointsServerTransport(&s.srv.DataCollectionEndpointsServer) }) resp, err = s.trDataCollectionEndpointsServer.Do(req) case "DataCollectionRuleAssociationsClient": - initServer(s, &s.trDataCollectionRuleAssociationsServer, func() *DataCollectionRuleAssociationsServerTransport { + initServer(&s.trMu, &s.trDataCollectionRuleAssociationsServer, func() *DataCollectionRuleAssociationsServerTransport { return NewDataCollectionRuleAssociationsServerTransport(&s.srv.DataCollectionRuleAssociationsServer) }) resp, err = s.trDataCollectionRuleAssociationsServer.Do(req) case "DataCollectionRulesClient": - initServer(s, &s.trDataCollectionRulesServer, func() *DataCollectionRulesServerTransport { + initServer(&s.trMu, &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 { + initServer(&s.trMu, &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) }) + initServer(&s.trMu, &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) }) + initServer(&s.trMu, &s.trMetricAlertsServer, func() *MetricAlertsServerTransport { return NewMetricAlertsServerTransport(&s.srv.MetricAlertsServer) }) resp, err = s.trMetricAlertsServer.Do(req) case "MetricAlertsStatusClient": - initServer(s, &s.trMetricAlertsStatusServer, func() *MetricAlertsStatusServerTransport { + initServer(&s.trMu, &s.trMetricAlertsStatusServer, func() *MetricAlertsStatusServerTransport { return NewMetricAlertsStatusServerTransport(&s.srv.MetricAlertsStatusServer) }) resp, err = s.trMetricAlertsStatusServer.Do(req) case "MetricDefinitionsClient": - initServer(s, &s.trMetricDefinitionsServer, func() *MetricDefinitionsServerTransport { + initServer(&s.trMu, &s.trMetricDefinitionsServer, func() *MetricDefinitionsServerTransport { return NewMetricDefinitionsServerTransport(&s.srv.MetricDefinitionsServer) }) resp, err = s.trMetricDefinitionsServer.Do(req) case "MetricNamespacesClient": - initServer(s, &s.trMetricNamespacesServer, func() *MetricNamespacesServerTransport { + initServer(&s.trMu, &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) }) + initServer(&s.trMu, &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 { + initServer(&s.trMu, &s.trPredictiveMetricServer, func() *PredictiveMetricServerTransport { return NewPredictiveMetricServerTransport(&s.srv.PredictiveMetricServer) }) resp, err = s.trPredictiveMetricServer.Do(req) case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + initServer(&s.trMu, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) }) resp, err = s.trPrivateEndpointConnectionsServer.Do(req) case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) case "PrivateLinkScopeOperationStatusClient": - initServer(s, &s.trPrivateLinkScopeOperationStatusServer, func() *PrivateLinkScopeOperationStatusServerTransport { + initServer(&s.trMu, &s.trPrivateLinkScopeOperationStatusServer, func() *PrivateLinkScopeOperationStatusServerTransport { return NewPrivateLinkScopeOperationStatusServerTransport(&s.srv.PrivateLinkScopeOperationStatusServer) }) resp, err = s.trPrivateLinkScopeOperationStatusServer.Do(req) case "PrivateLinkScopedResourcesClient": - initServer(s, &s.trPrivateLinkScopedResourcesServer, func() *PrivateLinkScopedResourcesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkScopedResourcesServer, func() *PrivateLinkScopedResourcesServerTransport { return NewPrivateLinkScopedResourcesServerTransport(&s.srv.PrivateLinkScopedResourcesServer) }) resp, err = s.trPrivateLinkScopedResourcesServer.Do(req) case "PrivateLinkScopesClient": - initServer(s, &s.trPrivateLinkScopesServer, func() *PrivateLinkScopesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkScopesServer, func() *PrivateLinkScopesServerTransport { return NewPrivateLinkScopesServerTransport(&s.srv.PrivateLinkScopesServer) }) resp, err = s.trPrivateLinkScopesServer.Do(req) + case "ScheduledQueryRuleClient": + initServer(&s.trMu, &s.trScheduledQueryRuleServer, func() *ScheduledQueryRuleServerTransport { + return NewScheduledQueryRuleServerTransport(&s.srv.ScheduledQueryRuleServer) + }) + resp, err = s.trScheduledQueryRuleServer.Do(req) case "ScheduledQueryRulesClient": - initServer(s, &s.trScheduledQueryRulesServer, func() *ScheduledQueryRulesServerTransport { + initServer(&s.trMu, &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) + case "ServiceDiagnosticSettingsClient": + initServer(&s.trMu, &s.trServiceDiagnosticSettingsServer, func() *ServiceDiagnosticSettingsServerTransport { + return NewServiceDiagnosticSettingsServerTransport(&s.srv.ServiceDiagnosticSettingsServer) }) - resp, err = s.trTenantActionGroupsServer.Do(req) + resp, err = s.trServiceDiagnosticSettingsServer.Do(req) case "TenantActivityLogsClient": - initServer(s, &s.trTenantActivityLogsServer, func() *TenantActivityLogsServerTransport { + initServer(&s.trMu, &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) } @@ -263,11 +277,3 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } - -func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { - s.trMu.Lock() - if *dst == nil { - *dst = src() - } - s.trMu.Unlock() -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/servicediagnosticsettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/servicediagnosticsettings_server.go new file mode 100644 index 000000000000..4a4bb819a08d --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/fake/servicediagnosticsettings_server.go @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +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" + "slices" +) + +// ServiceDiagnosticSettingsServer is a fake server for instances of the armmonitor.ServiceDiagnosticSettingsClient type. +type ServiceDiagnosticSettingsServer struct { + // CreateOrUpdate is the fake for method ServiceDiagnosticSettingsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK + CreateOrUpdate func(ctx context.Context, resourceURI string, parameters armmonitor.ServiceDiagnosticSettingsResource, options *armmonitor.ServiceDiagnosticSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.ServiceDiagnosticSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ServiceDiagnosticSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, options *armmonitor.ServiceDiagnosticSettingsClientGetOptions) (resp azfake.Responder[armmonitor.ServiceDiagnosticSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method ServiceDiagnosticSettingsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceURI string, serviceDiagnosticSettingsResource armmonitor.ServiceDiagnosticSettingsResourcePatch, options *armmonitor.ServiceDiagnosticSettingsClientUpdateOptions) (resp azfake.Responder[armmonitor.ServiceDiagnosticSettingsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewServiceDiagnosticSettingsServerTransport creates a new instance of ServiceDiagnosticSettingsServerTransport with the provided implementation. +// The returned ServiceDiagnosticSettingsServerTransport instance is connected to an instance of armmonitor.ServiceDiagnosticSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServiceDiagnosticSettingsServerTransport(srv *ServiceDiagnosticSettingsServer) *ServiceDiagnosticSettingsServerTransport { + return &ServiceDiagnosticSettingsServerTransport{srv: srv} +} + +// ServiceDiagnosticSettingsServerTransport connects instances of armmonitor.ServiceDiagnosticSettingsClient to instances of ServiceDiagnosticSettingsServer. +// Don't use this type directly, use NewServiceDiagnosticSettingsServerTransport instead. +type ServiceDiagnosticSettingsServerTransport struct { + srv *ServiceDiagnosticSettingsServer +} + +// Do implements the policy.Transporter interface for ServiceDiagnosticSettingsServerTransport. +func (s *ServiceDiagnosticSettingsServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *ServiceDiagnosticSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if serviceDiagnosticSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = serviceDiagnosticSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServiceDiagnosticSettingsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ServiceDiagnosticSettingsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServiceDiagnosticSettingsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *ServiceDiagnosticSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.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/service` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmonitor.ServiceDiagnosticSettingsResource](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).ServiceDiagnosticSettingsResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServiceDiagnosticSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.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/service` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + respr, errRespr := s.srv.Get(req.Context(), resourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).ServiceDiagnosticSettingsResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServiceDiagnosticSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/diagnosticSettings/service` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmonitor.ServiceDiagnosticSettingsResourcePatch](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).ServiceDiagnosticSettingsResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ServiceDiagnosticSettingsServerTransport +var serviceDiagnosticSettingsServerTransportInterceptor 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/tenantactiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go deleted file mode 100644 index 471d3e127e20..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 index e1647cf75962..5f5d47507214 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,7 +13,7 @@ import ( "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" + "slices" ) // TenantActivityLogsServer is a fake server for instances of the armmonitor.TenantActivityLogsClient type. @@ -49,21 +48,35 @@ func (t *TenantActivityLogsServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TenantActivityLogsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TenantActivityLogsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if tenantActivityLogsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = tenantActivityLogsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TenantActivityLogsClient.NewListPager": + res.resp, res.err = t.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -73,16 +86,8 @@ func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Reque 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) + filterParam := getOptional(qp.Get("$filter")) + selectParam := getOptional(qp.Get("$select")) var options *armmonitor.TenantActivityLogsClientListOptions if filterParam != nil || selectParam != nil { options = &armmonitor.TenantActivityLogsClientListOptions{ @@ -101,7 +106,7 @@ func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Reque if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -110,3 +115,9 @@ func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to TenantActivityLogsServerTransport +var tenantActivityLogsServerTransportInterceptor 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/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go deleted file mode 100644 index 20befe79b78d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 9dca62acb080..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 74ea7c10941c..23524e700510 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor go 1.25.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.2.0 @@ -20,9 +20,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.52.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/monitor/armmonitor/go.sum b/sdk/resourcemanager/monitor/armmonitor/go.sum index 441132f4be57..5bc0609e8582 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.sum +++ b/sdk/resourcemanager/monitor/armmonitor/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= @@ -38,15 +38,15 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/sdk/resourcemanager/monitor/armmonitor/interfaces.go b/sdk/resourcemanager/monitor/armmonitor/interfaces.go index ae5495b3ccbd..7af8c0da2e26 100644 --- a/sdk/resourcemanager/monitor/armmonitor/interfaces.go +++ b/sdk/resourcemanager/monitor/armmonitor/interfaces.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -9,7 +8,7 @@ package armmonitor // 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 +// - *PromQLCriteria, *WebtestLocationAvailabilityCriteria type MetricAlertCriteriaClassification interface { // GetMetricAlertCriteria returns the MetricAlertCriteria content of the underlying type. GetMetricAlertCriteria() *MetricAlertCriteria @@ -24,29 +23,11 @@ type MultiMetricCriteriaClassification interface { GetMultiMetricCriteria() *MultiMetricCriteria } -// RuleActionClassification provides polymorphic access to related types. -// Call the interface's GetRuleAction() method to access the common type. +// MultiPromQLCriteriaClassification provides polymorphic access to related types. +// Call the interface's GetMultiPromQLCriteria() 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 +// - *DynamicPromQLCriteria, *MultiPromQLCriteria, *StaticPromQLCriteria +type MultiPromQLCriteriaClassification interface { + // GetMultiPromQLCriteria returns the MultiPromQLCriteria content of the underlying type. + GetMultiPromQLCriteria() *MultiPromQLCriteria } diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go index 519e1d39f343..17693c25b961 100644 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // LogProfilesClient contains the methods for the LogProfiles group. // Don't use this type directly, use NewLogProfilesClient() instead. +// +// Generated from API version 2016-03-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredenti // 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 @@ -71,24 +70,25 @@ func (client *LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *LogProfilesClient) createOrUpdateCreateRequest(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *LogProfilesClient) createOrUpdateCreateRequest(ctx context.Context, logProfileName string, parameters LogProfileResource, _ *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)) + 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.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() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -106,8 +106,6 @@ func (client *LogProfilesClient) createOrUpdateHandleResponse(resp *http.Respons // 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) { @@ -132,30 +130,28 @@ func (client *LogProfilesClient) Delete(ctx context.Context, logProfileName stri } // deleteCreateRequest creates the Delete request. -func (client *LogProfilesClient) deleteCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (*policy.Request, error) { +func (client *LogProfilesClient) deleteCreateRequest(ctx context.Context, logProfileName string, _ *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)) + 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.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() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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) { @@ -181,23 +177,23 @@ func (client *LogProfilesClient) Get(ctx context.Context, logProfileName string, } // getCreateRequest creates the Get request. -func (client *LogProfilesClient) getCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (*policy.Request, error) { +func (client *LogProfilesClient) getCreateRequest(ctx context.Context, logProfileName string, _ *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)) + 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.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() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -212,27 +208,24 @@ func (client *LogProfilesClient) getHandleResponse(resp *http.Response) (LogProf } // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 LogProfilesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LogProfilesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -240,7 +233,7 @@ func (client *LogProfilesClient) NewListPager(options *LogProfilesClientListOpti } // listCreateRequest creates the List request. -func (client *LogProfilesClient) listCreateRequest(ctx context.Context, options *LogProfilesClientListOptions) (*policy.Request, error) { +func (client *LogProfilesClient) listCreateRequest(ctx context.Context, _ *LogProfilesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -251,8 +244,8 @@ func (client *LogProfilesClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -268,8 +261,6 @@ func (client *LogProfilesClient) listHandleResponse(resp *http.Response) (LogPro // 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. @@ -296,7 +287,7 @@ func (client *LogProfilesClient) Update(ctx context.Context, logProfileName stri } // updateCreateRequest creates the Update request. -func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (*policy.Request, error) { +func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, _ *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") @@ -311,9 +302,10 @@ func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logPro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20160301) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, logProfilesResource); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go index e7d2d1c9f3b8..1da441c38b54 100644 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go @@ -1,142 +1,229 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", nil) + res, err := clientFactory.NewLogProfilesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResource{ + Location: to.Ptr(""), + 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{}, + }, 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 = armmonitor.LogProfilesClientCreateOrUpdateResponse{ + // 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/getLogProfile.json -func ExampleLogProfilesClient_Get() { +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewLogProfilesClient().Get(ctx, "default", nil) + res, err := clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", 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"), - // }, - // } + // res = armmonitor.LogProfilesClientDeleteResponse{ + // } } -// 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() { +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", 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) + 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")}, + // res = armmonitor.LogProfilesClientGetResponse{ + // 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"), + // 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 +// Generated from example definition: 2016-03-01/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("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", 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 = armmonitor.LogProfilesClientListResponse{ + // 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"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2016-03-01/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) + clientFactory, err := armmonitor.NewClientFactory("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -145,9 +232,11 @@ func ExampleLogProfilesClient_Update() { Categories: []*string{ to.Ptr("Write"), to.Ptr("Delete"), - to.Ptr("Action")}, + to.Ptr("Action"), + }, Locations: []*string{ - to.Ptr("global")}, + to.Ptr("global"), + }, RetentionPolicy: &armmonitor.RetentionPolicy{ Days: to.Ptr[int32](3), Enabled: to.Ptr(true), @@ -165,95 +254,31 @@ func ExampleLogProfilesClient_Update() { // 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")}, + // res = armmonitor.LogProfilesClientUpdateResponse{ + // 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"), + // to.Ptr("global"), // }, - // } -} - -// 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"), - // }, - // }}, - // } - } + // 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"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go index eb9e756e0a41..d3349f739614 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // MetricAlertsClient contains the methods for the MetricAlerts group. // Don't use this type directly, use NewMetricAlertsClient() instead. +// +// Generated from API version 2024-03-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredent // 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. @@ -72,8 +71,8 @@ func (client *MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGr } // 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}" +func (client *MetricAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, _ *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") } @@ -91,9 +90,10 @@ func (client *MetricAlertsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *MetricAlertsClient) createOrUpdateHandleResponse(resp *http.Respon // 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. @@ -138,8 +136,8 @@ func (client *MetricAlertsClient) Delete(ctx context.Context, resourceGroupName } // 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}" +func (client *MetricAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *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") } @@ -157,16 +155,13 @@ func (client *MetricAlertsClient) deleteCreateRequest(ctx context.Context, resou 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"} + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. @@ -193,8 +188,8 @@ func (client *MetricAlertsClient) Get(ctx context.Context, resourceGroupName str } // 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}" +func (client *MetricAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *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") } @@ -212,8 +207,8 @@ func (client *MetricAlertsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -228,29 +223,26 @@ func (client *MetricAlertsClient) getHandleResponse(resp *http.Response) (Metric } // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 MetricAlertsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -258,8 +250,8 @@ func (client *MetricAlertsClient) NewListByResourceGroupPager(resourceGroupName } // 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" +func (client *MetricAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") } @@ -273,8 +265,8 @@ func (client *MetricAlertsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -289,28 +281,25 @@ func (client *MetricAlertsClient) listByResourceGroupHandleResponse(resp *http.R } // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 MetricAlertsClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -318,7 +307,7 @@ func (client *MetricAlertsClient) NewListBySubscriptionPager(options *MetricAler } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Context, options *MetricAlertsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *MetricAlertsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -329,8 +318,8 @@ func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,8 +335,6 @@ func (client *MetricAlertsClient) listBySubscriptionHandleResponse(resp *http.Re // 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. @@ -375,8 +362,8 @@ func (client *MetricAlertsClient) Update(ctx context.Context, resourceGroupName } // 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}" +func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, _ *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") } @@ -394,9 +381,10 @@ func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go index 20868a2a6934..c22b8ced8ae2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go @@ -1,613 +1,548 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" + "time" ) -// 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() { +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ + Location: to.Ptr("global"), + 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{ + AllOf: []armmonitor.MultiMetricCriteriaClassification{ + &armmonitor.DynamicMetricCriteria{ + Name: to.Ptr("High_CPU_80"), + AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + Dimensions: []*armmonitor.MetricDimension{}, + FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ + MinFailingPeriodsToAlert: to.Ptr[float32](4), + NumberOfEvaluationPeriods: to.Ptr[float32](4), + }, + MetricName: to.Ptr("Percentage CPU"), + MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + }, + 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"), + }, + 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/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{ + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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"), // }, - // 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), + // }, + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // AllOf: []armmonitor.MultiMetricCriteriaClassification{ + // &armmonitor.DynamicMetricCriteria{ + // Name: to.Ptr("High_CPU_80"), + // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ + // MinFailingPeriodsToAlert: to.Ptr[float32](4), + // NumberOfEvaluationPeriods: to.Ptr[float32](4), + // }, + // MetricName: to.Ptr("Percentage CPU"), + // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ + Location: to.Ptr("global"), + 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{ + AllOf: []armmonitor.MultiMetricCriteriaClassification{ + &armmonitor.DynamicMetricCriteria{ + Name: to.Ptr("High_CPU_80"), + AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + Dimensions: []*armmonitor.MetricDimension{}, + 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 }()), + MetricName: to.Ptr("Percentage CPU"), + MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + }, + 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"), + }, + 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/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{ + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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"), // }, - // 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), + // }, + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // AllOf: []armmonitor.MultiMetricCriteriaClassification{ + // &armmonitor.DynamicMetricCriteria{ + // Name: to.Ptr("High_CPU_80"), + // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // 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}()), + // MetricName: to.Ptr("Percentage CPU"), + // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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), + // TargetResourceRegion: to.Ptr("southcentralus"), + // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), // WindowSize: to.Ptr("PT15M"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ + Location: to.Ptr("global"), + 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{ + 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"), + Operator: to.Ptr(armmonitor.OperatorGreaterThan), + Threshold: to.Ptr[float64](80.5), + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + }, + 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"), + }, + 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/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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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{ + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/createOrUpdateMetricAlertQuery.json +func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAQueryBasedAlertRule() { 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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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) + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ + Identity: &armmonitor.Identity{ + Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}, + }, + }, + Location: to.Ptr("eastus"), + Properties: &armmonitor.MetricAlertProperties{ + Description: to.Ptr("This is the description of the rule1"), + ActionProperties: map[string]*string{ + "Email.Sujbect": to.Ptr("my custom email subject"), + }, + Actions: []*armmonitor.MetricAlertAction{ + { + ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + }, + }, + Criteria: &armmonitor.PromQLCriteria{ + AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + &armmonitor.StaticPromQLCriteria{ + Name: to.Ptr("Metric1"), + CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + Query: to.Ptr("avg({\"system.cpu.utilization\"}) > 90"), + }, + }, + FailingPeriods: &armmonitor.QueryFailingPeriods{ + For: to.Ptr("PT5M"), + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), + }, + Enabled: to.Ptr(true), + EvaluationFrequency: to.Ptr("PT1M"), + ResolveConfiguration: &armmonitor.ResolveConfiguration{ + AutoResolved: to.Ptr(true), + TimeToResolve: to.Ptr("PT10M"), + }, + Scopes: []*string{ + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"), + }, + Severity: to.Ptr[int32](3), + }, + 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/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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Identity: &armmonitor.Identity{ + // Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + // "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": &armmonitor.UserIdentityProperties{ + // ClientID: to.Ptr("778f4d04-3c60-4622-a839-5cf05866c983"), + // PrincipalID: to.Ptr("669dd76d-cde8-4dc3-b882-1de566b0c628"), // }, - // }}, - // 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"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // ActionProperties: map[string]*string{ + // "Email.Sujbect": to.Ptr("my custom email subject"), + // }, + // Actions: []*armmonitor.MetricAlertAction{ + // { + // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), // }, - // }}, - // 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{ + // }, + // Criteria: &armmonitor.PromQLCriteria{ + // AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + // &armmonitor.StaticPromQLCriteria{ + // Name: to.Ptr("Metric1"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Query: to.Ptr("avg({\"system.cpu.utilization\"}) > 90"), // }, - // 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")}, + // }, + // FailingPeriods: &armmonitor.QueryFailingPeriods{ + // For: to.Ptr("PT2M"), + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + // }, + // CustomProperties: map[string]*string{ + // "key11": to.Ptr("value11"), + // "key12": to.Ptr("value12"), + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT1M"), + // ResolveConfiguration: &armmonitor.ResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"), + // }, // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/createOrUpdateMetricAlertQueryDT.json +func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAQueryBasedAlertRuleWithDynamicThreshold() { 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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{}, + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ + Identity: &armmonitor.Identity{ + Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}, + }, + }, + Location: to.Ptr("eastus"), Properties: &armmonitor.MetricAlertProperties{ Description: to.Ptr("This is the description of the rule1"), + ActionProperties: map[string]*string{ + "Email.Sujbect": to.Ptr("my custom email subject"), + }, 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), + ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + }, + }, + Criteria: &armmonitor.PromQLCriteria{ + AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + &armmonitor.DynamicPromQLCriteria{ + Name: to.Ptr("Metric1"), AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, + CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t }()), + Operator: to.Ptr(armmonitor.DynamicThresholdOperatorLessThan), + Query: to.Ptr("avg({\"system.cpu.utilization\"})"), + }, + }, + FailingPeriods: &armmonitor.QueryFailingPeriods{ + For: to.Ptr("PT5M"), + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), }, Enabled: to.Ptr(true), EvaluationFrequency: to.Ptr("PT1M"), + ResolveConfiguration: &armmonitor.ResolveConfiguration{ + AutoResolved: to.Ptr(true), + TimeToResolve: to.Ptr("PT10M"), + }, 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"), + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"), + }, + Severity: to.Ptr[int32](3), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -615,107 +550,127 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleFor // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Identity: &armmonitor.Identity{ + // Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + // "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": &armmonitor.UserIdentityProperties{ + // ClientID: to.Ptr("778f4d04-3c60-4622-a839-5cf05866c983"), + // PrincipalID: to.Ptr("669dd76d-cde8-4dc3-b882-1de566b0c628"), // }, - // }}, - // 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")}, + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // ActionProperties: map[string]*string{ + // "Email.Sujbect": to.Ptr("my custom email subject"), + // }, + // Actions: []*armmonitor.MetricAlertAction{ + // { + // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + // }, + // }, + // Criteria: &armmonitor.PromQLCriteria{ + // AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + // &armmonitor.DynamicPromQLCriteria{ + // Name: to.Ptr("Metric1"), + // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t}()), + // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorLessThan), + // Query: to.Ptr("avg({\"system.cpu.utilization\"})"), + // }, + // }, + // FailingPeriods: &armmonitor.QueryFailingPeriods{ + // For: to.Ptr("PT2M"), + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + // }, + // CustomProperties: map[string]*string{ + // "key11": to.Ptr("value11"), + // "key12": to.Ptr("value12"), + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT1M"), + // ResolveConfiguration: &armmonitor.ResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"), + // }, // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/createOrUpdateMetricAlertQueryMultiResource.json +func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAResourceCentricQueryBasedAlertRuleForMultipleResources() { 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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{}, + Identity: &armmonitor.Identity{ + Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}, + }, + }, + Location: to.Ptr("eastus"), Properties: &armmonitor.MetricAlertProperties{ Description: to.Ptr("This is the description of the rule1"), + ActionProperties: map[string]*string{ + "Email.Sujbect": to.Ptr("my custom email subject"), + }, 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"), + ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + }, + }, + Criteria: &armmonitor.PromQLCriteria{ + AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + &armmonitor.StaticPromQLCriteria{ + Name: to.Ptr("Metric1"), + CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + Query: to.Ptr("avg({\"system.cpu.utilization\"}) by (\"microsoft.resourceid\") > 90"), }, - }}, - 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), - }}, + }, + FailingPeriods: &armmonitor.QueryFailingPeriods{ + For: to.Ptr("PT5M"), + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), }, Enabled: to.Ptr(true), EvaluationFrequency: to.Ptr("PT1M"), + ResolveConfiguration: &armmonitor.ResolveConfiguration{ + AutoResolved: to.Ptr(true), + TimeToResolve: to.Ptr("PT10M"), + }, 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"), + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"), + }, + Severity: to.Ptr[int32](3), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -723,90 +678,124 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleFor // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Identity: &armmonitor.Identity{ + // Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + // "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": &armmonitor.UserIdentityProperties{ + // ClientID: to.Ptr("778f4d04-3c60-4622-a839-5cf05866c983"), + // PrincipalID: to.Ptr("669dd76d-cde8-4dc3-b882-1de566b0c628"), // }, - // }}, - // 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")}, + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // ActionProperties: map[string]*string{ + // "Email.Sujbect": to.Ptr("my custom email subject"), + // }, + // Actions: []*armmonitor.MetricAlertAction{ + // { + // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + // }, + // }, + // Criteria: &armmonitor.PromQLCriteria{ + // AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + // &armmonitor.StaticPromQLCriteria{ + // Name: to.Ptr("Metric1"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Query: to.Ptr("avg({\"system.cpu.utilization\"}) by (\"microsoft.resourceid\") > 90"), + // }, + // }, + // FailingPeriods: &armmonitor.QueryFailingPeriods{ + // For: to.Ptr("PT2M"), + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + // }, + // CustomProperties: map[string]*string{ + // "key11": to.Ptr("value11"), + // "key12": to.Ptr("value12"), + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT1M"), + // ResolveConfiguration: &armmonitor.ResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // 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"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/createOrUpdateMetricAlertQueryResourceCentric.json +func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAResourceCentricQueryBasedAlertRule() { 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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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"), + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ + Identity: &armmonitor.Identity{ + Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}, + }, }, + Location: to.Ptr("eastus"), 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"), + Description: to.Ptr("This is the description of the rule1"), + ActionProperties: map[string]*string{ + "Email.Sujbect": to.Ptr("my custom email subject"), + }, + Actions: []*armmonitor.MetricAlertAction{ + { + ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + }, + }, + Criteria: &armmonitor.PromQLCriteria{ + AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + &armmonitor.StaticPromQLCriteria{ + Name: to.Ptr("Metric1"), + CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + Query: to.Ptr("avg({\"system.cpu.utilization\"}) > 90"), + }, + }, + FailingPeriods: &armmonitor.QueryFailingPeriods{ + For: to.Ptr("PT5M"), + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), }, Enabled: to.Ptr(true), EvaluationFrequency: to.Ptr("PT1M"), + ResolveConfiguration: &armmonitor.ResolveConfiguration{ + AutoResolved: to.Ptr(true), + TimeToResolve: to.Ptr("PT10M"), + }, 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"), + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.compute/virtualMachines/myVmName"), + }, + Severity: to.Ptr[int32](3), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -814,50 +803,79 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAWebTestAlertRule() // 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{ + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Identity: &armmonitor.Identity{ + // Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + // "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": &armmonitor.UserIdentityProperties{ + // ClientID: to.Ptr("778f4d04-3c60-4622-a839-5cf05866c983"), + // PrincipalID: to.Ptr("669dd76d-cde8-4dc3-b882-1de566b0c628"), + // }, + // }, // }, - // 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"), + // Location: to.Ptr("eastus"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // ActionProperties: map[string]*string{ + // "Email.Sujbect": to.Ptr("my custom email subject"), + // }, + // Actions: []*armmonitor.MetricAlertAction{ + // { + // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), + // }, + // }, + // Criteria: &armmonitor.PromQLCriteria{ + // AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + // &armmonitor.StaticPromQLCriteria{ + // Name: to.Ptr("Metric1"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Query: to.Ptr("avg({\"system.cpu.utilization\"}) > 90"), + // }, + // }, + // FailingPeriods: &armmonitor.QueryFailingPeriods{ + // For: to.Ptr("PT2M"), + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + // }, + // CustomProperties: map[string]*string{ + // "key11": to.Ptr("value11"), + // "key12": to.Ptr("value12"), + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT1M"), + // ResolveConfiguration: &armmonitor.ResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.compute/virtualMachines/myVmName"), + // }, + // Severity: to.Ptr[int32](3), // }, - // 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"), + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), // }, - // } + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ + 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{ @@ -867,10 +885,10 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultip "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"), @@ -878,21 +896,25 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultip 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), - }}, + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), }, 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")}, + 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"), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -900,66 +922,70 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultip // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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{ + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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 +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{ @@ -969,28 +995,32 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingle "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), - }}, + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), }, Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), + EvaluationFrequency: to.Ptr("PT1M"), Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), + }, Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), + WindowSize: to.Ptr("PT15M"), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -998,164 +1028,66 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingle // 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{ + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // Actions: []*armmonitor.MetricAlertAction{ // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ + // 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"), // }, - // 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{ + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ + // AllOf: []*armmonitor.MetricCriteria{ + // { + // Name: to.Ptr("High_CPU_80"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), // WindowSize: to.Ptr("PT15M"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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 +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{ @@ -1165,10 +1097,10 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscri "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"), @@ -1176,20 +1108,24 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscri 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), - }}, + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), }, Enabled: to.Ptr(true), EvaluationFrequency: to.Ptr("PT1M"), Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, + 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"), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1197,65 +1133,69 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscri // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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{ + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // 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")}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), // }, - // } + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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 +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{ @@ -1265,10 +1205,10 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDime "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"), @@ -1278,28 +1218,35 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDime Name: to.Ptr("ActivityName"), Operator: to.Ptr("Include"), Values: []*string{ - to.Ptr("*")}, + to.Ptr("*"), + }, }, { Name: to.Ptr("StatusCode"), Operator: to.Ptr("Include"), Values: []*string{ - to.Ptr("200")}, - }}, + 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), - }}, + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), }, 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")}, + to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource"), + }, Severity: to.Ptr[int32](3), WindowSize: to.Ptr("P1D"), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1307,106 +1254,105 @@ func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDime // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // 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("*")}, + // }, + // AutoMitigate: to.Ptr(true), + // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ + // 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"), + // to.Ptr("200"), + // }, + // }, + // }, + // MetricName: to.Ptr("Availability"), + // MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](55), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, // }, - // } + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("12345678-1234-1234-1234-123456789101", 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), - }}, + res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "rg-example", "webtest-name-example", armmonitor.MetricAlertResource{ + Location: to.Ptr("global"), + Properties: &armmonitor.MetricAlertProperties{ + Description: to.Ptr("Automatically created alert rule for availability test \"component-example\" a"), + Actions: []*armmonitor.MetricAlertAction{}, + Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ + ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"), + FailedLocationCount: to.Ptr[float32](2), + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), + 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"), + 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"), + 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"), + }, + 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"), }, - Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1414,61 +1360,925 @@ func ExampleMetricAlertsClient_Update() { // 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"), + // res = armmonitor.MetricAlertsClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\" a"), + // Actions: []*armmonitor.MetricAlertAction{ + // }, + // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ + // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), + // FailedLocationCount: to.Ptr[float32](2), + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), + // 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"), + // }, + // 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("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"), + // } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMetricAlertsClient().Delete(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 = armmonitor.MetricAlertsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-03-01-preview/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("00000000-0000-0000-0000-000000000000", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // 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{ + // AllOf: []armmonitor.MultiMetricCriteriaClassification{ + // &armmonitor.DynamicMetricCriteria{ + // Name: to.Ptr("High_CPU_80"), + // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ + // MinFailingPeriodsToAlert: to.Ptr[float32](4), + // NumberOfEvaluationPeriods: to.Ptr[float32](4), + // }, + // MetricName: to.Ptr("Percentage CPU"), + // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("00000000-0000-0000-0000-000000000000", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("This is the description of the rule1"), + // Actions: []*armmonitor.MetricAlertAction{ // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ + // 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{ + // AllOf: []armmonitor.MultiMetricCriteriaClassification{ + // &armmonitor.DynamicMetricCriteria{ + // Name: to.Ptr("High_CPU_80"), + // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ + // MinFailingPeriodsToAlert: to.Ptr[float32](4), + // NumberOfEvaluationPeriods: to.Ptr[float32](4), + // }, + // MetricName: to.Ptr("Percentage CPU"), + // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), + // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), // }, - // 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")}, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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), - // WindowSize: to.Ptr("Pt15m"), + // TargetResourceRegion: to.Ptr("southcentralus"), + // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), + // WindowSize: to.Ptr("PT15M"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), // }, - // } + // }, + // } } -// 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() { +// Generated from example definition: 2024-03-01-preview/getMetricAlertQuery.json +func ExampleMetricAlertsClient_Get_getAQueryBasedAlertRule() { 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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewMetricAlertsClient().Delete(ctx, "gigtest", "chiricutin", nil) + 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // Identity: &armmonitor.Identity{ + // Type: to.Ptr(armmonitor.IdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armmonitor.UserIdentityProperties{ + // "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": &armmonitor.UserIdentityProperties{ + // ClientID: to.Ptr("778f4d04-3c60-4622-a839-5cf05866c983"), + // PrincipalID: to.Ptr("669dd76d-cde8-4dc3-b882-1de566b0c628"), + // }, + // }, + // }, + // Location: to.Ptr("eastus"), + // 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.PromQLCriteria{ + // AllOf: []armmonitor.MultiPromQLCriteriaClassification{ + // &armmonitor.StaticPromQLCriteria{ + // Name: to.Ptr("Metric1"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Query: to.Ptr("floor(minute(vector(time())) / 10 ) % 2 == 1"), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorPromQLCriteria), + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT1M"), + // ResolveConfiguration: &armmonitor.ResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"), + // }, + // Severity: to.Ptr[int32](3), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // 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{ + // AllOf: []*armmonitor.MetricCriteria{ + // { + // Name: to.Ptr("High_CPU_80"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/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("12345678-1234-1234-1234-123456789101", 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 = armmonitor.MetricAlertsClientGetResponse{ + // 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"), + // Properties: &armmonitor.MetricAlertProperties{ + // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\""), + // Actions: []*armmonitor.MetricAlertAction{ + // }, + // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ + // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), + // FailedLocationCount: to.Ptr[float32](2), + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), + // 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"), + // }, + // 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"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01-preview/listByResourceGroupMetricAlert.json +func ExampleMetricAlertsClient_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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMetricAlertsClient().NewListByResourceGroupPager("gigtest", 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 = armmonitor.MetricAlertsClientListByResourceGroupResponse{ + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // { + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](50.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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 = armmonitor.MetricAlertsClientListBySubscriptionResponse{ + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // { + // 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"), + // 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{ + // 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"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](50.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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"), + // }, + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-03-01-preview/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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", 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{ + AllOf: []*armmonitor.MetricCriteria{ + { + Name: to.Ptr("High_CPU_80"), + CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + Dimensions: []*armmonitor.MetricDimension{}, + MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), + Operator: to.Ptr(armmonitor.OperatorGreaterThan), + Threshold: to.Ptr[float64](80.5), + TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + }, + }, + ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + }, + 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 = armmonitor.MetricAlertsClientUpdateResponse{ + // 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"), + // 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{ + // AllOf: []*armmonitor.MetricCriteria{ + // { + // Name: to.Ptr("High_CPU_80"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), + // Dimensions: []*armmonitor.MetricDimension{ + // }, + // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), + // Operator: to.Ptr(armmonitor.OperatorGreaterThan), + // Threshold: to.Ptr[float64](80.5), + // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), + // }, + // }, + // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), + // }, + // 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{ + // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go index da4d844c5f82..7e15bfe8d908 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // MetricAlertsStatusClient contains the methods for the MetricAlertsStatus group. // Don't use this type directly, use NewMetricAlertsStatusClient() instead. +// +// Generated from API version 2024-03-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,8 +43,6 @@ func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenC // 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. @@ -70,8 +69,8 @@ func (client *MetricAlertsStatusClient) List(ctx context.Context, resourceGroupN } // 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" +func (client *MetricAlertsStatusClient) listCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *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") } @@ -89,8 +88,8 @@ func (client *MetricAlertsStatusClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -106,8 +105,6 @@ func (client *MetricAlertsStatusClient) listHandleResponse(resp *http.Response) // 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. @@ -136,7 +133,7 @@ func (client *MetricAlertsStatusClient) ListByName(ctx context.Context, resource } // listByNameCreateRequest creates the ListByName request. -func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (*policy.Request, error) { +func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, statusName string, _ *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") @@ -159,8 +156,8 @@ func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20240301Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go index d8eb1d027f9d..4d66e5b426be 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,31 +29,34 @@ func ExampleMetricAlertsStatusClient_List() { // 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"), + // res = armmonitor.MetricAlertsStatusClientListResponse{ + // 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.6293237Z"); return t}()), // }, - // 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 +// Generated from example definition: 2024-03-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("009f6022-67ec-423e-9aa7-691182870588", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -67,19 +67,22 @@ func ExampleMetricAlertsStatusClient_ListByName() { // 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"), + // res = armmonitor.MetricAlertsStatusClientListByNameResponse{ + // 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.6293237Z"); return t}()), // }, - // 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 index 5f696df6df57..9b689d217216 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // MetricDefinitionsClient contains the methods for the MetricDefinitions group. // Don't use this type directly, use NewMetricDefinitionsClient() instead. +// +// Generated from API version 2024-02-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,29 +42,26 @@ func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCr } // NewListPager - Lists the metric definitions for the resource. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. +// - resourceURI - The fully qualified Azure Resource manager 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceURI, options) + }, nil) 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(), @@ -73,17 +71,20 @@ func (client *MetricDefinitionsClient) NewListPager(resourceURI string, options // 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" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } 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") + reqQP.Set("api-version", version20240201) if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -98,29 +99,26 @@ func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) ( } // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtSubscriptionScopeCreateRequest(ctx, region, options) + }, nil) 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(), @@ -139,12 +137,12 @@ func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) + reqQP.Set("api-version", version20240201) if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("region", region) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go index ac516ad29036..8660fb76ce98 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go @@ -1,32 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2024-02-01/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) + 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")}) + 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 { @@ -37,86 +35,21 @@ func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { _ = 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), - // }, + // page = armmonitor.MetricDefinitionsClientListResponse{ + // MetricDefinitionCollection: armmonitor.MetricDefinitionCollection{ + // Value: []*armmonitor.MetricDefinition{ // { // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Billable (Deprecated)"), - // Value: to.Ptr("Network In"), + // LocalizedValue: to.Ptr("CPU Time"), + // Value: to.Ptr("CpuTime"), // }, // Dimensions: []*armmonitor.LocalizableString{ // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), + // LocalizedValue: to.Ptr("Instance"), + // Value: to.Ptr("Instance"), // }, - // { - // 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"), + // }, + // 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{ // { @@ -150,3132 +83,93 @@ func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { // { // 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), + // }, + // }, + // 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("Availability tests"), - // Value: to.Ptr("availabilityResults/count"), + // LocalizedValue: to.Ptr("Requests"), + // Value: to.Ptr("Requests"), // }, - // Category: to.Ptr("Availability"), // Dimensions: []*armmonitor.LocalizableString{ // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), + // 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{ // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), + // Retention: to.Ptr("P93D"), + // TimeGrain: to.Ptr("PT1M"), // }, // { - // 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"), + // 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{ // { @@ -3309,1829 +203,33 @@ func ExampleMetricDefinitionsClient_NewListPager_getApplicationInsightsMetricDef // { // 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"), + // }, + // }, + // 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.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), + // 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("Requests"), - // Value: to.Ptr("Requests"), + // 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/Requests"), + // }, + // }, + // 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{ // { @@ -5165,7 +263,8 @@ func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilt // { // 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"), @@ -5175,893 +274,22 @@ func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilt // 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), + // to.Ptr(armmonitor.AggregationTypeCount), + // }, + // Unit: to.Ptr(armmonitor.MetricUnitBytes), // }, // { // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Client Latency"), - // Value: to.Ptr("ClientLatency"), + // LocalizedValue: to.Ptr("Http 101"), + // Value: to.Ptr("Http101"), // }, - // 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"), + // 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{ // { @@ -6095,1148 +323,7271 @@ func ExampleMetricDefinitionsClient_NewListPager_getStorageCacheMetricDefinition // { // 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"), + // }, + // }, + // 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.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), - // }}, - // } + // 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: 2024-02-01/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 = armmonitor.MetricDefinitionsClientListResponse{ + // 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: 2024-02-01/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 = armmonitor.MetricDefinitionsClientListResponse{ + // 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), + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/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("92d2a2d8-b514-432d-8cc9-a5f9272630d5", 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 = armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse{ + // 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), + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go index 37e021c78caf..09f3a9606d81 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" @@ -17,13 +17,15 @@ import ( // MetricNamespacesClient contains the methods for the MetricNamespaces group. // Don't use this type directly, use NewMetricNamespacesClient() instead. +// +// Generated from API version 2024-02-01 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. +// - options - Contains optional client configuration. 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 { @@ -36,29 +38,26 @@ func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.C } // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, 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 + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceURI, options) + }, nil) 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(), @@ -68,17 +67,20 @@ func (client *MetricNamespacesClient) NewListPager(resourceURI string, options * // 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" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } 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") + reqQP.Set("api-version", version20240201) if options != nil && options.StartTime != nil { reqQP.Set("startTime", *options.StartTime) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go index 44126334a75a..5b82805120ee 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go @@ -1,32 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2024-02-01/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) + 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")}) + 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 { @@ -37,26 +35,29 @@ func ExampleMetricNamespacesClient_NewListPager() { _ = 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"), + // page = armmonitor.MetricNamespacesClientListResponse{ + // 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"), + // { + // 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 index 7417f7285687..1b21ca8b78cf 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -20,15 +19,17 @@ import ( // MetricsClient contains the methods for the Metrics group. // Don't use this type directly, use NewMetricsClient() instead. +// +// Generated from API version 2024-02-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -41,11 +42,9 @@ func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// List - Lists the metric values for a resource. +// List - **Lists the metric values for a resource**. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling). // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. +// - resourceURI - The fully qualified Azure Resource manager 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 @@ -72,47 +71,53 @@ func (client *MetricsClient) List(ctx context.Context, resourceURI string, optio // 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" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } 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.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + 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)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) } + reqQP.Set("api-version", version20240201) 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.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } 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.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -126,10 +131,8 @@ func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsCli return result, nil } -// ListAtSubscriptionScope - Lists the metric data for a subscription. +// ListAtSubscriptionScope - **Lists the metric data for a subscription**. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling). // 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. @@ -167,42 +170,45 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co 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.Filter != nil { + reqQP.Set("$filter", *options.Filter) } + 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)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + reqQP.Set("api-version", version20240201) 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.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } if options != nil && options.Orderby != nil { reqQP.Set("orderby", *options.Orderby) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("region", region) 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.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -210,17 +216,15 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.Response); 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. +// ListAtSubscriptionScopePost - **Lists the metric data for a subscription**. Parameters can be specified on either query +// params or the body. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling). // 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. @@ -258,44 +262,48 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex 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.Filter != nil { + reqQP.Set("$filter", *options.Filter) } + 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)) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + reqQP.Set("api-version", version20240201) 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.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) } if options != nil && options.Orderby != nil { reqQP.Set("orderby", *options.Orderby) } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("region", region) 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.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -307,7 +315,7 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.Response); 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 index 019041813984..7b5823ab329f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go @@ -1,1477 +1,1960 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2024-02-01/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) + 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"), + res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{ + Filter: to.Ptr("Tier eq '*'"), AutoAdjustTimegrain: to.Ptr(true), ValidateDimensions: to.Ptr(false), - }) + Aggregation: to.Ptr("average,minimum,maximum"), + Interval: to.Ptr("PT6H"), + Metricnames: to.Ptr("BlobCount,BlobCapacity"), + Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), + Orderby: to.Ptr("average asc"), + Timespan: to.Ptr("2021-04-20T09:00:00.000Z/2021-04-20T14:00:00.000Z"), + Top: to.Ptr[int32](5)}) 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"), - // }}, + // res = armmonitor.MetricsClientListResponse{ + // 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"), // }, - // { - // 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}()), + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Hot"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Standard"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Cool"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Archive"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Untiered"), + // }, // }, - // { - // 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"), - // }}, + // Unit: to.Ptr(armmonitor.MetricUnitCount), + // }, + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("Blob Capacity"), + // Value: to.Ptr("BlobCapacity"), // }, - // { - // 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}()), + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Standard"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Hot"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Archive"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Untiered"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), + // }, + // { + // 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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:00Z"); 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}()), + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Cool"), + // }, // }, - // { - // 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), - // }}, + // 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/GetMultiResourceMetricMetadata.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricMetadata() { +// Generated from example definition: 2024-02-01/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) + 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, - }) + res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", &armmonitor.MetricsClientListOptions{ + AutoAdjustTimegrain: to.Ptr(true), + ValidateDimensions: to.Ptr(false), + Aggregation: to.Ptr("average"), + Interval: to.Ptr("FULL"), + Metricnames: to.Ptr("MongoRequestsCount,MongoRequests"), + Metricnamespace: to.Ptr("microsoft.documentdb/databaseaccounts"), + Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z")}) 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"), + // res = armmonitor.MetricsClientListResponse{ + // 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.MetricUnitCountPerSecond), // }, - // 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"), - // }}, + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("Mongo Requests"), + // Value: to.Ptr("MongoRequests"), // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("1"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, + // 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:00Z"); return t}()), + // }, + // }, + // Metadatavalues: []*armmonitor.MetadataValue{ + // }, + // }, + // }, + // 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/PostMultiResourceMetricBody.json -func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricDataUsingBodyParams() { +// Generated from example definition: 2024-02-01/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) + 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), - }, - }) + res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{ + Filter: to.Ptr("Tier eq '*'"), + Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), + Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z")}) 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"), - // }}, + // res = armmonitor.MetricsClientListResponse{ + // 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"), // }, - // { - // 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}()), + // 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"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), + // }, + // { + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Archive"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), + // }, + // { + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Standard"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), + // }, + // { + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Untiered"), + // }, // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), + // }, + // { + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("tier"), + // Value: to.Ptr("tier"), + // }, + // Value: to.Ptr("Hot"), + // }, // }, - // { - // 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), - // }}, + // 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() { +// Generated from example definition: 2024-02-01/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) + clientFactory, err := armmonitor.NewClientFactory("92d2a2d8-b514-432d-8cc9-a5f9272630d5", 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"), + res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ + Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), AutoAdjustTimegrain: to.Ptr(true), ValidateDimensions: to.Ptr(false), - }) + Aggregation: to.Ptr("count"), + Interval: to.Ptr("PT6H"), + Metricnames: to.Ptr("Data Disk Max Burst IOPS"), + Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), + Orderby: to.Ptr("count desc"), + Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), + Top: to.Ptr[int32](10)}) 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"), - // }}, + // res = armmonitor.MetricsClientListAtSubscriptionScopeResponse{ + // Response: armmonitor.Response{ + // 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.Metric{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), + // Value: to.Ptr("Data Disk Max Burst IOPS"), // }, - // { - // 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}()), + // 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](413), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](133), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](78), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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"), + // }, + // }, + // Unit: to.Ptr(armmonitor.MetricUnitCount), // }, - // 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"), - // }}, + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01/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("92d2a2d8-b514-432d-8cc9-a5f9272630d5", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ + Filter: to.Ptr("LUN eq '0'"), + Metricnames: to.Ptr("Data Disk Max Burst IOPS"), + Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), + Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z")}) + 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 = armmonitor.MetricsClientListAtSubscriptionScopeResponse{ + // Response: armmonitor.Response{ + // 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.Metric{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), + // Value: to.Ptr("Data Disk Read Bytes/sec"), // }, - // { - // 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Metadatavalues: []*armmonitor.MetadataValue{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("lun"), + // Value: to.Ptr("lun"), + // }, + // Value: to.Ptr("1"), + // }, // }, - // { - // 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}()), + // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01/PostMultiResourceMetric.json +func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricData() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("92d2a2d8-b514-432d-8cc9-a5f9272630d5", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ + Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), + AutoAdjustTimegrain: to.Ptr(true), + ValidateDimensions: to.Ptr(false), + Aggregation: to.Ptr("count"), + Interval: to.Ptr("PT6H"), + Metricnames: to.Ptr("Data Disk Max Burst IOPS"), + Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), + Orderby: to.Ptr("count desc"), + Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), + Top: to.Ptr[int32](10)}) + 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 = armmonitor.MetricsClientListAtSubscriptionScopePostResponse{ + // Response: armmonitor.Response{ + // 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.Metric{ + // { + // 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](413), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](133), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](78), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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}()), + // }, + // { + // Data: []*armmonitor.MetricValue{ + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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}()), + // 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"), + // }, // }, - // { - // 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), - // }}, + // }, + // }, + // 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/GetMetricMetadata.json -func ExampleMetricsClient_List_getMetricForMetadata() { +// Generated from example definition: 2024-02-01/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) + clientFactory, err := armmonitor.NewClientFactory("92d2a2d8-b514-432d-8cc9-a5f9272630d5", 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, - }) + res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ + 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("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), + 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.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"), - // }}, + // res = armmonitor.MetricsClientListAtSubscriptionScopePostResponse{ + // Response: armmonitor.Response{ + // 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.Metric{ + // { + // Name: &armmonitor.LocalizableString{ + // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), + // Value: to.Ptr("Data Disk Max Burst IOPS"), // }, - // { - // 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"), - // }}, + // 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](413), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](133), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](78), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00Z"); return t}()), + // }, + // { + // Count: to.Ptr[float64](72), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00Z"); 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"), + // }, + // }, + // }, // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, + // 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/GetMetricError.json -func ExampleMetricsClient_List_getMetricWithError() { +// Generated from example definition: 2024-02-01/PostMultiResourceMetricMetadata.json +func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricMetadata() { 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) + clientFactory, err := armmonitor.NewClientFactory("92d2a2d8-b514-432d-8cc9-a5f9272630d5", 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), - }) + res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ + Filter: to.Ptr("LUN eq '0'"), + Metricnames: to.Ptr("Data Disk Max Burst IOPS"), + Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), + Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z")}) 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{ + // res = armmonitor.MetricsClientListAtSubscriptionScopePostResponse{ + // Response: armmonitor.Response{ + // 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.Metric{ + // { + // 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), // }, - // 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 ece6ff38f54b..95ea20f05ac3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -10,13 +9,13 @@ 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. + // 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. + // 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. @@ -24,8 +23,7 @@ type AccessModeSettings struct { } // 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. +// 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 @@ -38,6 +36,42 @@ type AccessModeSettingsExclusion struct { QueryAccessMode *AccessMode } +// AccessRule - Access rule in a network security perimeter configuration profile +type AccessRule struct { + // Name of the access rule + Name *string + Properties *AccessRuleProperties +} + +// AccessRuleProperties - Properties of Access Rule +type AccessRuleProperties struct { + // Address prefixes in the CIDR format for inbound rules + AddressPrefixes []*string + Direction *AccessRuleDirection + + // Email addresses for outbound rules + EmailAddresses []*string + + // Fully qualified domain names (FQDN) for outbound rules + FullyQualifiedDomainNames []*string + + // Network security perimeters for inbound rules + NetworkSecurityPerimeters []*NetworkSecurityPerimeter + + // Phone numbers for outbound rules + PhoneNumbers []*string + + // Subscriptions for inbound rules + Subscriptions *AccessRulePropertiesSubscriptionsItem +} + +// AccessRulePropertiesSubscriptionsItem - we add this model in order to replace subscriptions model in CommonTypes with this +// model via alternateType decorator +type AccessRulePropertiesSubscriptionsItem struct { + // The fully qualified Azure resource ID of the subscription e.g. ('/subscriptions/00000000-0000-0000-0000-000000000000') + ID *string +} + // ActionDetail - The action detail type ActionDetail struct { // The detail of the friendly error message @@ -87,6 +121,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 @@ -103,22 +140,13 @@ 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. - NextLink *string - - // The list of action groups. + // REQUIRED; The ActionGroupResource items on this page Value []*ActionGroupResource + + // The link to the next page of items + NextLink *string } // ActionGroupPatch - An Azure action group for patch operations. @@ -127,26 +155,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 @@ -154,29 +169,35 @@ type ActionGroupPatchBodyAutoGenerated struct { // ActionGroupResource - An action group resource. type ActionGroupResource struct { - // REQUIRED; Resource location + // REQUIRED; The geo-location where the resource lives Location *string + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + // The action groups properties of the resource. Properties *ActionGroup - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure resource type + // 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 } // ActionList - A list of Activity Log Alert rule actions. type ActionList struct { // The list of the Action Groups. - ActionGroups []*ActionGroupAutoGenerated + ActionGroups []*ActivityLogAlertActionGroup } // Actions to invoke when the alert fires. @@ -184,14 +205,28 @@ 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 } +// ActivityLogAlertActionGroup - A pointer to an Azure Action Group. +type ActivityLogAlertActionGroup struct { + // REQUIRED; The resource ID of the Action Group. This cannot be null or empty. + ActionGroupID *string + + // Predefined list of properties and configuration items for the action group. + ActionProperties map[string]*string + + // the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + WebhookProperties 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'. + // The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions. Location *string // The Activity Log Alert rule properties of the resource. @@ -200,41 +235,43 @@ type ActivityLogAlertResource struct { // The tags of the resource. Tags map[string]*string - // READ-ONLY; The resource Id. + // 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. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. + // 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 } -// AlertRule - An alert rule. -type AlertRule struct { - // REQUIRED; the condition that results in the alert rule being activated. - Condition RuleConditionClassification +// AdxDestination - Azure Data Explorer (Adx) destination. +type AdxDestination struct { + // The name of the database to which data will be ingested. + DatabaseName *string - // REQUIRED; the flag that indicates whether the alert rule is enabled. - IsEnabled *bool - - // REQUIRED; the name of the alert rule. + // A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection 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 ARM resource id of the Adx resource. + ResourceID *string - // the description of the alert rule that will be included in the alert email. - Description *string + // READ-ONLY; The ingestion uri of the Adx resource. + IngestionURI *string +} - // the provisioning state. - ProvisioningState *string +// AgentSetting - A setting used to control an agent behavior on a host machine +type AgentSetting struct { + // The name of the setting. + // Must be part of the list of supported settings + Name *KnownAgentSettingName - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time + // The value of the setting + Value *string } // AlertRuleAllOfCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. @@ -244,12 +281,12 @@ type AlertRuleAllOfCondition struct { } // 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. +// 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 @@ -261,14 +298,15 @@ type AlertRuleAnyOfOrLeafCondition struct { // 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', + // 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'. +// 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. @@ -277,19 +315,19 @@ type AlertRuleLeafCondition struct { // 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', + // 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. + // REQUIRED; The ActivityLogAlertResource items on this page Value []*ActivityLogAlertResource + + // The link to the next page of items + NextLink *string } // AlertRulePatchObject - An Activity Log Alert rule object for the body of patch operations. @@ -316,53 +354,27 @@ type AlertRuleProperties struct { // 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 -} + // 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 -// AlertRuleResourceCollection - Represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - // the values for the alert rule resources. - Value []*AlertRuleResource + // The tenant GUID. Must be provided for tenant-level and management group events rules. + TenantScope *string } -// AlertRuleResourcePatch - The alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // The properties of an alert rule. - Properties *AlertRule +type ApplicationInsights struct { + // REQUIRED; The name of the reference used as an alias when referencing this application insights in Otel data sources + Name *string - // Resource tags - Tags map[string]*string + // REQUIRED; Id of the application insights resource + ResourceID *string } // ArmRoleReceiver - An arm role receiver. @@ -391,6 +403,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 @@ -401,30 +416,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" @@ -484,36 +475,34 @@ type AutoscaleSetting struct { // AutoscaleSettingResource - The autoscale setting resource. type AutoscaleSettingResource struct { - // REQUIRED; Resource location + // REQUIRED; The geo-location where the resource lives 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. + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata related to the response. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Azure resource type + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AutoscaleSettingResourceCollection - Represents a collection of autoscale setting resources. type AutoscaleSettingResourceCollection struct { - // REQUIRED; the values for the autoscale setting resources. + // REQUIRED; The AutoscaleSettingResource items on this page Value []*AutoscaleSettingResource - // URL to get the next set of results. + // The link to the next page of items NextLink *string } @@ -535,16 +524,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. @@ -559,17 +538,13 @@ 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 @@ -587,20 +562,19 @@ type AzureMonitorPrivateLinkScope struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; System data + // 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 } -// AzureMonitorPrivateLinkScopeListResult - Describes the list of Azure Monitor PrivateLinkScope resources. +// AzureMonitorPrivateLinkScopeListResult - The response of a AzureMonitorPrivateLinkScope list operation. type AzureMonitorPrivateLinkScopeListResult struct { - // REQUIRED; List of Azure Monitor PrivateLinkScope definitions. + // REQUIRED; The AzureMonitorPrivateLinkScope items on this page Value []*AzureMonitorPrivateLinkScope - // The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned - // in the result set. + // The link to the next page of items NextLink *string } @@ -613,136 +587,8 @@ type AzureMonitorPrivateLinkScopeProperties struct { PrivateEndpointConnections []*PrivateEndpointConnection // 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 -} - -// 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 - - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings - - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics - - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState -} - -// 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 - - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *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 - - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string -} - -// AzureMonitorWorkspaceResource - An Azure Monitor Workspace definition -type AzureMonitorWorkspaceResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource properties - Properties *AzureMonitorWorkspaceResourceProperties - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource entity tag (ETag) - 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; 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 -} - -// 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 - - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings - - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics - - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState -} - -// 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 -} - -// 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 - - // READ-ONLY; The type of the resource. - Type *string + // is defined. Users cannot change this value but are able to read from it. + ProvisioningState *PrivateLinkScopeProvisioningState } // BaselineMetadata - Represents a baseline metadata value. @@ -765,6 +611,13 @@ type ColumnDefinition struct { // 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 + + // Specifies the type of threshold criteria + CriterionType *CriterionType + // List of Dimensions conditions Dimensions []*Dimension @@ -772,12 +625,19 @@ type Condition struct { // only for rules of the kind LogAlert. FailingPeriods *ConditionFailingPeriods + // 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 + // 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 minimum results count that should be found for triggering an alert. Relevant only for rules of the kind SimpleLogAlert. + MinRecurrenceCount *int64 + // The criteria operator. Relevant and required only for rules of the kind LogAlert. Operator *ConditionOperator @@ -788,7 +648,8 @@ type Condition struct { // 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. + // the criteria threshold value that activates the alert. Relevant and required only for static threshold rules of the kind + // LogAlert. Threshold *float64 // Aggregation type. Relevant and required only for rules of the kind LogAlert. @@ -807,12 +668,6 @@ type ConditionFailingPeriods struct { NumberOfEvaluationPeriods *int64 } -// ConfigurationAccessEndpointSpec - Definition of the endpoint used for accessing configuration. -type ConfigurationAccessEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} - // Context - The context info type Context struct { // The context id type @@ -822,47 +677,14 @@ type Context struct { NotificationSource *string } -// DataCollectionEndpoint - Definition of data collection endpoint. -type DataCollectionEndpoint struct { - // The endpoint used by clients to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess - - // Description of the data collection endpoint. - Description *string - - // The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string - - // The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion - - // The endpoint used by clients to ingest metrics. - MetricsIngestion *DataCollectionEndpointMetricsIngestion - - // Network access control rules for the endpoints. - NetworkACLs *DataCollectionEndpointNetworkACLs - - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. - FailoverConfiguration *DataCollectionEndpointFailoverConfiguration - - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. - Metadata *DataCollectionEndpointMetadata - - // 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 - - // READ-ONLY; The resource provisioning state. This property is READ-ONLY. - ProvisioningState *KnownDataCollectionEndpointProvisioningState -} - // DataCollectionEndpointConfigurationAccess - The endpoint used by clients to access their configuration. type DataCollectionEndpointConfigurationAccess struct { // READ-ONLY; The endpoint. This property is READ-ONLY. Endpoint *string } -// DataCollectionEndpointFailoverConfiguration - Failover configuration on this endpoint. This property is READ-ONLY. +// DataCollectionEndpointFailoverConfiguration - Metadata for the resource. This property can only be updated by Log Analytics +// Control Plane for Data Collection Endpoint with Log Analytics Destination. type DataCollectionEndpointFailoverConfiguration struct { // Active location where data flow will occur. ActiveLocation *string @@ -877,11 +699,15 @@ type DataCollectionEndpointLogsIngestion struct { Endpoint *string } -// DataCollectionEndpointMetadata - Metadata for the resource. This property is READ-ONLY. +// DataCollectionEndpointMetadata - Metadata for the resource. This property can only be updated by Log Analytics Control +// Plane for Data Collection Endpoint with Log Analytics Destination. type DataCollectionEndpointMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } @@ -900,47 +726,44 @@ type DataCollectionEndpointNetworkACLs struct { // DataCollectionEndpointResource - Definition of ARM tracked top level resource. type DataCollectionEndpointResource struct { - // REQUIRED; The geo-location where the resource lives. + // REQUIRED; The geo-location where the resource lives Location *string // Managed service identity of the resource. Identity *DataCollectionEndpointResourceIdentity // The kind of the resource. - Kind *KnownDataCollectionEndpointResourceKind - - // Resource properties. + Kind *KnownDataCollectionEndpointResourceKind Properties *DataCollectionEndpointResourceProperties + // The SKU of the resource. + SKU *DataCollectionEndpointResourceSKU + // Resource tags. Tags map[string]*string // READ-ONLY; Resource entity tag (ETag). Etag *string - // READ-ONLY; Fully qualified ID of the resource. + // 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. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionEndpointResourceSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DataCollectionEndpointResourceIdentity - Managed service identity of the resource. type DataCollectionEndpointResourceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. 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. + // The identities assigned to this resource by the user. 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 @@ -951,16 +774,15 @@ type DataCollectionEndpointResourceIdentity struct { TenantID *string } -// DataCollectionEndpointResourceListResult - A pageable list of resources. +// DataCollectionEndpointResourceListResult - The response of a DataCollectionEndpointResource list operation. type DataCollectionEndpointResourceListResult struct { - // REQUIRED; A list of resources. + // REQUIRED; The DataCollectionEndpointResource items on this page Value []*DataCollectionEndpointResource - // The URL to use for getting the next set of results. + // The link to the next page of items NextLink *string } -// DataCollectionEndpointResourceProperties - Resource properties. type DataCollectionEndpointResourceProperties struct { // The endpoint used by clients to access their configuration. ConfigurationAccess *DataCollectionEndpointConfigurationAccess @@ -980,10 +802,12 @@ type DataCollectionEndpointResourceProperties struct { // Network access control rules for the endpoints. NetworkACLs *DataCollectionEndpointNetworkACLs - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. + // READ-ONLY; Metadata for the resource. This property can only be updated by Log Analytics Control Plane for Data Collection + // Endpoint with Log Analytics Destination. FailoverConfiguration *DataCollectionEndpointFailoverConfiguration - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. + // READ-ONLY; Metadata for the resource. This property can only be updated by Log Analytics Control Plane for Data Collection + // Endpoint with Log Analytics Destination. Metadata *DataCollectionEndpointMetadata // READ-ONLY; List of Azure Monitor Private Link Scope Resources to which this data collection endpoint resource is associated. @@ -994,74 +818,30 @@ type DataCollectionEndpointResourceProperties struct { ProvisioningState *KnownDataCollectionEndpointProvisioningState } -// DataCollectionEndpointResourceSystemData - Metadata pertaining to creation and last modification of the resource. -type DataCollectionEndpointResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time +// DataCollectionEndpointResourceSKU - The SKU of the resource. +type DataCollectionEndpointResourceSKU struct { + // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string - // The identity that created the resource. - CreatedBy *string + // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the + // resource this may be omitted. + Capacity *int32 - // The type of identity that created the resource. - CreatedByType *CreatedByType + // If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string + // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType + // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required + // on a PUT. + Tier *SKUTier } -// 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 - - // 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 -} - -// 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 +// DataCollectionRuleAgentSettings - Agent settings used to modify agent behavior on a given host +type DataCollectionRuleAgentSettings struct { + // All the settings that are applicable to the logs agent (AMA) + Logs []*AgentSetting } // DataCollectionRuleAssociationMetadata - Metadata about the resource @@ -1069,41 +849,43 @@ type DataCollectionRuleAssociationMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *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. + // 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. + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// DataCollectionRuleAssociationProxyOnlyResourceListResult - A pageable list of resources. +// DataCollectionRuleAssociationProxyOnlyResourceListResult - The response of a DataCollectionRuleAssociationProxyOnlyResource +// list operation. type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { - // REQUIRED; A list of resources. + // REQUIRED; The DataCollectionRuleAssociationProxyOnlyResource items on this page Value []*DataCollectionRuleAssociationProxyOnlyResource - // The URL to use for getting the next set of results. + // The link to the next page of items NextLink *string } -// DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { // The resource ID of the data collection endpoint that is to be associated. DataCollectionEndpointID *string @@ -1121,34 +903,15 @@ type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { 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. +// 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 ETW providers data source configurations. + EtwProviders []*EtwProviderDataSource + // The list of Azure VM extension data source configurations. Extensions []*ExtensionDataSource @@ -1158,9 +921,21 @@ type DataCollectionRuleDataSources struct { // The list of Log files source configurations. LogFiles []*LogFilesDataSource + // The list of Otel Logs data source configurations. + OtelLogs []*OtelLogsDataSource + + // The list of OTel metrics data source configurations. + OtelMetrics []*OtelMetricsDataSource + + // The list of Otel traces data source configurations. + OtelTraces []*OtelTracesDataSource + // The list of performance counter data source configurations. PerformanceCounters []*PerfCounterDataSource + // The list of Open Telemetry performance counter data source configurations. + PerformanceCountersOTel []*PerformanceCountersOTelDataSource + // The list of platform telemetry configurations PlatformTelemetry []*PlatformTelemetryDataSource @@ -1179,6 +954,9 @@ type DataCollectionRuleDataSources struct { // DataCollectionRuleDestinations - The specification of destinations. type DataCollectionRuleDestinations struct { + // List of Azure Data Explorer destinations. + AzureDataExplorer []*AdxDestination + // Azure Monitor Metrics destination. AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics @@ -1191,6 +969,9 @@ type DataCollectionRuleDestinations struct { // List of Log Analytics destinations. LogAnalytics []*LogAnalyticsDestination + // List of Microsoft Fabric destinations. + MicrosoftFabric []*MicrosoftFabricDestination + // List of monitoring account destinations. MonitoringAccounts []*MonitoringAccountDestination @@ -1204,58 +985,94 @@ type DataCollectionRuleDestinations struct { StorageTablesDirect []*StorageTableDestination } +// DataCollectionRuleDirectDataSources - The specification of direct data sources. +// This property is optional and can be omitted. +type DataCollectionRuleDirectDataSources struct { + // The list of OTel logs data source configurations. + OtelLogs []*OtelLogsDirectDataSource + + // The list of OTel metrics data source configurations. + OtelMetrics []*OtelMetricsDirectDataSource + + // The list of OTel traces data source configurations. + OtelTraces []*OtelTracesDirectDataSource +} + +// DataCollectionRuleEndpoints - Defines the ingestion endpoints to send data to via this rule. +type DataCollectionRuleEndpoints struct { + // READ-ONLY; The ingestion endpoint for logs + LogsIngestion *string + + // READ-ONLY; The ingestion endpoint for metrics + MetricsIngestion *string +} + +// DataCollectionRuleIngestionQuotas - The specification for ingestion limits +type DataCollectionRuleIngestionQuotas struct { + Logs *IngestionQuotasLogs +} + // DataCollectionRuleMetadata - Metadata about the resource type DataCollectionRuleMetadata struct { // READ-ONLY; Azure offering managing this resource on-behalf-of customer. ProvisionedBy *string + // READ-ONLY; Immutable Id of azure offering managing this resource on-behalf-of customer. + ProvisionedByImmutableID *string + // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. ProvisionedByResourceID *string } +// DataCollectionRuleReferences - Defines all the references that may be used in other sections of the DCR +type DataCollectionRuleReferences struct { + // Application Insights references to be used on OTel metrics/logs enrichment + ApplicationInsights []*ApplicationInsights + + // All the enrichment data sources referenced in data flows + EnrichmentData *ReferencesSpecEnrichmentData +} + // DataCollectionRuleResource - Definition of ARM tracked top level resource. type DataCollectionRuleResource struct { - // REQUIRED; The geo-location where the resource lives. + // 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. + Kind *KnownDataCollectionRuleResourceKind Properties *DataCollectionRuleResourceProperties + // The SKU of the resource. + SKU *DataCollectionRuleResourceSKU + // Resource tags. Tags map[string]*string // READ-ONLY; Resource entity tag (ETag). Etag *string - // READ-ONLY; Fully qualified ID of the resource. + // 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. + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 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). + // REQUIRED; The type of managed identity assigned to this resource. 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. + // The identities assigned to this resource by the user. 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 @@ -1266,25 +1083,27 @@ type DataCollectionRuleResourceIdentity struct { TenantID *string } -// DataCollectionRuleResourceListResult - A pageable list of resources. +// DataCollectionRuleResourceListResult - The response of a DataCollectionRuleResource list operation. type DataCollectionRuleResourceListResult struct { - // REQUIRED; A list of resources. + // REQUIRED; The DataCollectionRuleResource items on this page Value []*DataCollectionRuleResource - // The URL to use for getting the next set of results. + // The link to the next page of items NextLink *string } -// DataCollectionRuleResourceProperties - Resource properties. type DataCollectionRuleResourceProperties struct { + // Agent settings used to modify agent behavior on a given host + AgentSettings *DataCollectionRuleAgentSettings + // 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. + // 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. @@ -1293,12 +1112,25 @@ type DataCollectionRuleResourceProperties struct { // The specification of destinations. Destinations *DataCollectionRuleDestinations + // The specification of direct data sources. + // This property is optional and can be omitted. + DirectDataSources *DataCollectionRuleDirectDataSources + + // Defines all the references that may be used in other sections of the DCR + References *DataCollectionRuleReferences + // Declaration of custom streams used in this rule. StreamDeclarations map[string]*StreamDeclaration + // READ-ONLY; Defines the ingestion endpoints to send data to via this rule. + Endpoints *DataCollectionRuleEndpoints + // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. ImmutableID *string + // READ-ONLY; The specification for ingestion limits + IngestionQuotas *DataCollectionRuleIngestionQuotas + // READ-ONLY; Metadata about the resource Metadata *DataCollectionRuleMetadata @@ -1306,31 +1138,24 @@ type DataCollectionRuleResourceProperties struct { 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 +// DataCollectionRuleResourceSKU - The SKU of the resource. +type DataCollectionRuleResourceSKU struct { + // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time + // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the + // resource this may be omitted. + Capacity *int32 - // The identity that last modified the resource. - LastModifiedBy *string + // If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType -} + // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string -// DataContainer - Information about a container with data for a given resource. -type DataContainer struct { - // REQUIRED; Log Analytics workspace information. - Workspace *WorkspaceInfo + // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required + // on a PUT. + Tier *SKUTier } // DataFlow - Definition of which streams are sent to which destinations. @@ -1338,6 +1163,9 @@ type DataFlow struct { // The builtIn transform to transform stream data BuiltInTransform *string + // Flag to enable overflow column in LA destinations + CaptureOverflow *bool + // List of destinations for this data flow. Destinations []*string @@ -1351,194 +1179,32 @@ type DataFlow struct { 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. + // 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. + // 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 @@ -1554,10 +1220,11 @@ type Dimension struct { // 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. + // series pattern. Previously undocumented values might be returned AlertSensitivity *DynamicThresholdSensitivity - // REQUIRED; Specifies the type of threshold criteria + // CONSTANT; Specifies the type of threshold criteria. Previously undocumented values might be returned + // Field has constant value CriterionTypeDynamicThresholdCriterion, any specified value is ignored. CriterionType *CriterionType // REQUIRED; The minimum number of violations required within the selected lookback time window required to raise an alert. @@ -1569,13 +1236,12 @@ type DynamicMetricCriteria struct { // REQUIRED; Name of the criteria. Name *string - // REQUIRED; The operator used to compare the metric value against the threshold. + // REQUIRED; The operator used to compare the metric value against the threshold. Previously undocumented values might be + // returned Operator *DynamicThresholdOperator - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. + // REQUIRED; The criteria time aggregation types. Previously undocumented values might be returned + TimeAggregation *AggregationTypeEnum AdditionalProperties map[string]any // List of dimension conditions. @@ -1606,6 +1272,40 @@ func (d *DynamicMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { } } +// DynamicPromQLCriteria - The criterion for dynamic prom query. +type DynamicPromQLCriteria struct { + // REQUIRED; The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric + // series pattern. Previously undocumented values might be returned + AlertSensitivity *DynamicThresholdSensitivity + + // CONSTANT; Specifies the type of threshold criteria. Previously undocumented values might be returned + // Field has constant value CriterionTypeDynamicThresholdCriterion, any specified value is ignored. + CriterionType *CriterionType + + // REQUIRED; Name of the criteria. + Name *string + + // REQUIRED; The operator used to compare the metric value against the threshold. Previously undocumented values might be + // returned + Operator *DynamicThresholdOperator + + // REQUIRED; The query used to evaluate the alert rule + Query *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) + IgnoreDataBefore *time.Time +} + +// GetMultiPromQLCriteria implements the MultiPromQLCriteriaClassification interface for type DynamicPromQLCriteria. +func (d *DynamicPromQLCriteria) GetMultiPromQLCriteria() *MultiPromQLCriteria { + return &MultiPromQLCriteria{ + CriterionType: d.CriterionType, + Name: d.Name, + Query: d.Query, + } +} + // DynamicThresholdFailingPeriods - The minimum number of violations required within the selected lookback time window required // to raise an alert. type DynamicThresholdFailingPeriods struct { @@ -1625,31 +1325,16 @@ type EmailNotification struct { // 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 + // a value indicating whether to send email to subscription co-administrators. + SendToSubscriptionCoAdministrators *bool } -// EmailReceiverAutoGenerated - An email receiver. -type EmailReceiverAutoGenerated struct { +// 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 a tenant action group. + // 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. @@ -1665,15 +1350,6 @@ type EnableRequest struct { 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. @@ -1683,19 +1359,6 @@ type ErrorAdditionalInfo struct { 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. @@ -1714,82 +1377,29 @@ type ErrorDetail struct { 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 -} +// EtwProviderDataSource - Enables an ETW provider logs to be collected by this data collection rule. +type EtwProviderDataSource struct { + // REQUIRED; The provider GUID or class name for event source + Provider *string -// 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 -} + // REQUIRED; Provider type specification: By Manifest GUID or by Event Source name + ProviderType *KnownEtwProviderType -// 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 + // REQUIRED; List of streams that this data source will be sent to + Streams []*string - // READ-ONLY; The error code. - Code *string + // Events Ids to collect + EventIDs []*string - // READ-ONLY; The error details. - Details []*ErrorResponseDetails + // Event's membership in a set of event categories + Keyword *string - // READ-ONLY; The error message. - Message *string + // Minimal level of detail to be logged + LogLevel *KnownEtwProviderDataSourceLogLevel - // READ-ONLY; The error target. - Target *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 } // EventCategoryCollection - A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, @@ -1797,6 +1407,9 @@ type ErrorResponseDetails struct { type EventCategoryCollection struct { // REQUIRED; the list that includes the Azure event categories. Value []*LocalizableString + + // The link to the next page of items + NextLink *string } // EventData - The Azure event log entries are of type EventData @@ -1848,7 +1461,7 @@ type EventData struct { // READ-ONLY; the operation name. OperationName *LocalizableString - // READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. + // 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. @@ -1868,15 +1481,15 @@ type EventData struct { 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) + // 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. + // 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. @@ -1888,31 +1501,19 @@ type EventData struct { // EventDataCollection - Represents collection of events. type EventDataCollection struct { - // REQUIRED; this list that includes the Azure audit logs. + // REQUIRED; The EventData items on this page Value []*EventData - // Provides the link to retrieve the next set of events. + // The link to the next page of items 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. + // A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. Name *string } @@ -1920,8 +1521,8 @@ 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. + // A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. Name *string } @@ -1939,6 +1540,9 @@ type EventHubReceiver struct { // REQUIRED; The Id for the subscription containing this event hub SubscriptionID *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + // The tenant Id for the subscription containing this event hub TenantID *string @@ -1947,8 +1551,8 @@ type EventHubReceiver struct { } // 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. +// 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 @@ -1959,23 +1563,16 @@ type ExtensionDataSource struct { // 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. + // 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. + // 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 @@ -1997,8 +1594,7 @@ type Identity struct { 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}'. + // 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. @@ -2016,9 +1612,12 @@ type IisLogsDataSource struct { // 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. + // 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 KQL query to transform the data source. This is a deprecated property and will be removed in future versions. + TransformKql *string } // Incident - An alert incident indicates the activation status of an alert rule. @@ -2041,17 +1640,40 @@ type Incident struct { // IncidentListResult - The List incidents operation response. type IncidentListResult struct { + // the URL to get the next set of results. + NextLink *string + // 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 +// IncidentReceiver - An Incident receiver. +type IncidentReceiver struct { + // REQUIRED; The incident service connection + Connection *IncidentServiceConnection + + // REQUIRED; The incident management service type + IncidentManagementService *IncidentManagementService + + // REQUIRED; Field mappings for the incident service + Mappings map[string]*string + + // REQUIRED; The name of the Incident receiver. Names must be unique across all receivers within an action group. + Name *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 + + // REQUIRED; The name of the connection. + Name *string +} - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *string +type IngestionQuotasLogs struct { + MaxRequestsPerMinute *string + MaxSizePerMinuteInGB *string } // ItsmReceiver - An Itsm receiver. @@ -2090,36 +1712,10 @@ type LocationSpec struct { 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. + // 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. @@ -2129,24 +1725,12 @@ type LogAnalyticsDestination struct { 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 @@ -2155,16 +1739,19 @@ type LogFilesDataSource struct { // 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 + // 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. + // 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 + + // The KQL query to transform the data source. This is a deprecated property and will be removed in future versions. + TransformKql *string } // LogFilesDataSourceSettings - The log files specific settings. @@ -2177,6 +1764,9 @@ type LogFilesDataSourceSettings struct { type LogProfileCollection struct { // REQUIRED; the values of the log profiles. Value []*LogProfileResource + + // the URL to get the next set of results. + NextLink *string } // LogProfileProperties - The log profile properties. @@ -2193,8 +1783,7 @@ type LogProfileProperties struct { 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}'. + // 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. @@ -2203,22 +1792,25 @@ type LogProfileProperties struct { // LogProfileResource - The log profile resource. type LogProfileResource struct { - // REQUIRED; Resource location + // REQUIRED; The geo-location where the resource lives Location *string // REQUIRED; The log profile properties of the resource. Properties *LogProfileProperties - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure resource type + // 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 } @@ -2240,11 +1832,6 @@ type LogSettings struct { // 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 } @@ -2260,26 +1847,19 @@ type LogicAppReceiver struct { // REQUIRED; The azure resource id of the logic app receiver. ResourceID *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 } -// 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). + // REQUIRED; The type of managed identity assigned to this resource. 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. + // The identities assigned to this resource by the user. 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 @@ -2290,77 +1870,31 @@ type ManagedServiceIdentity struct { 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. + // The name of the metadata. Name *LocalizableString - // the value of the metadata. + // The value of the metadata. Value *string } // Metric - The result data of a query. type Metric struct { - // REQUIRED; the metric Id. + // REQUIRED; The metric Id. ID *string - // REQUIRED; the name and the display name of the metric, i.e. it is localizable 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. + // REQUIRED; The time series returned when a data query is performed. Timeseries []*TimeSeriesElement - // REQUIRED; the resource type of the metric resource. + // REQUIRED; The resource type of the metric resource. Type *string // REQUIRED; The unit of the metric. - Unit *Unit + Unit *MetricUnit // Detailed description of this metric. DisplayDescription *string @@ -2374,7 +1908,7 @@ type Metric struct { // MetricAlertAction - An alert action. type MetricAlertAction struct { - // the id of the action group to use. + // 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. @@ -2383,10 +1917,8 @@ type MetricAlertAction struct { // 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. + // REQUIRED; Specifies the type of the alert criteria. Previously undocumented values might be returned + ODataType *Odatatype AdditionalProperties map[string]any } @@ -2396,13 +1928,12 @@ func (m *MetricAlertCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { re // 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. + // CONSTANT; Specifies the type of the alert criteria. Previously undocumented values might be returned + // Field has constant value OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, any specified value is ignored. + ODataType *Odatatype AdditionalProperties map[string]any - // the list of multiple metric criteria for this 'all of' operation. + // The list of multiple metric criteria for this 'all of' operation. AllOf []MultiMetricCriteriaClassification } @@ -2416,42 +1947,52 @@ func (m *MetricAlertMultipleResourceMultipleMetricCriteria) GetMetricAlertCriter // MetricAlertProperties - An alert rule. type MetricAlertProperties struct { - // REQUIRED; defines the specific alert criteria information. + // REQUIRED; Defines the specific alert criteria information. Criteria MetricAlertCriteriaClassification - // REQUIRED; the flag that indicates whether the metric alert is enabled. + // 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. + // 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. + // REQUIRED; The list of resource id's that this metric alert is scoped to. You cannot change the scope of a metric rule based + // on logs. 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 properties of an action properties. + ActionProperties map[string]*string - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + // The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions []*MetricAlertAction - // the flag that indicates whether the alert should be auto resolved or not. The default is true. + // 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. + // The properties of an alert payload. + CustomProperties map[string]*string + + // 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, + // The configuration for how the alert is resolved. Applicable for PromQLCriteria. + ResolveConfiguration *ResolveConfiguration + + // 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, + // 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. + // 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. @@ -2460,40 +2001,49 @@ type MetricAlertProperties struct { // 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. + // The properties of an action properties. + ActionProperties map[string]*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. + // 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. + // Defines the specific alert criteria information. Criteria MetricAlertCriteriaClassification - // the description of the metric alert that will be included in the alert email. + // The properties of an alert payload. + CustomProperties map[string]*string + + // 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. + // 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. + // 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. + // The configuration for how the alert is resolved. Applicable for PromQLCriteria. + ResolveConfiguration *ResolveConfiguration + + // 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. + // 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. + // 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. + // 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. + // READ-ONLY; The value indicating whether this alert rule is migrated. IsMigrated *bool // READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -2502,33 +2052,45 @@ type MetricAlertPropertiesPatch struct { // MetricAlertResource - The metric alert resource. type MetricAlertResource struct { - // REQUIRED; Resource location + // REQUIRED; The geo-location where the resource lives Location *string // REQUIRED; The alert rule properties of the resource. Properties *MetricAlertProperties - // Resource tags + // The identity of the resource. + Identity *Identity + + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure resource type + // 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 } // MetricAlertResourceCollection - Represents a collection of alert rule resources. type MetricAlertResourceCollection struct { - // the values for the alert rule resources. + // The URL to get the next set of results. + NextLink *string + + // The values for the alert rule resources. Value []*MetricAlertResource } // MetricAlertResourcePatch - The metric alert resource for patch operations. type MetricAlertResourcePatch struct { + // The identity of the resource. + Identity *Identity + // The alert rule properties of the resource. Properties *MetricAlertPropertiesPatch @@ -2539,10 +2101,9 @@ type MetricAlertResourcePatch struct { // 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. + // CONSTANT; Specifies the type of the alert criteria. Previously undocumented values might be returned + // Field has constant value OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, any specified value is ignored. + ODataType *Odatatype AdditionalProperties map[string]any // The list of metric criteria for this 'all of' operation. @@ -2574,7 +2135,7 @@ type MetricAlertStatus struct { // MetricAlertStatusCollection - Represents a collection of alert rule resources. type MetricAlertStatusCollection struct { - // the values for the alert rule resources. + // The values for the alert rule resources. Value []*MetricAlertStatus } @@ -2583,7 +2144,7 @@ type MetricAlertStatusProperties struct { // An object describing the type of the dimensions. Dimensions map[string]*string - // status value + // Status value Status *string // UTC time when the status was checked. @@ -2593,10 +2154,10 @@ type MetricAlertStatusProperties struct { // 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. + // 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. + // The time grain specifies a supported aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. TimeGrain *string } @@ -2606,13 +2167,11 @@ type MetricBaselinesProperties struct { 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. + // 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. + // '/'. This may be adjusted in the future and returned back from what was originally requested. Timespan *string // The namespace of the metrics been queried. @@ -2621,13 +2180,17 @@ type MetricBaselinesProperties struct { // MetricBaselinesResponse - A list of metric baselines. type MetricBaselinesResponse struct { + // The URL to get the next set of results. + NextLink *string + // The list of metric baselines. Value []*SingleMetricBaseline } // MetricCriteria - Criterion to filter metrics. type MetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria + // CONSTANT; Specifies the type of threshold criteria. Previously undocumented values might be returned + // Field has constant value CriterionTypeStaticThresholdCriterion, any specified value is ignored. CriterionType *CriterionType // REQUIRED; Name of the metric. @@ -2636,16 +2199,14 @@ type MetricCriteria struct { // REQUIRED; Name of the criteria. Name *string - // REQUIRED; the criteria operator. + // REQUIRED; The criteria operator. Previously undocumented values might be returned Operator *Operator - // REQUIRED; the criteria threshold value that activates the alert. + // 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. + // REQUIRED; The criteria time aggregation types. Previously undocumented values might be returned + TimeAggregation *AggregationTypeEnum AdditionalProperties map[string]any // List of dimension conditions. @@ -2677,47 +2238,50 @@ 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. + // 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. + // 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. + // 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. + // The name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString - // the namespace the metric belongs to. + // The namespace the metric belongs to. Namespace *string - // the primary aggregation type value defining how to use the values for display. + // 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. + // The resource identifier of the resource that emitted the metric. ResourceID *string - // the collection of what aggregation types are supported. + // The collection of what aggregation types are supported. SupportedAggregationTypes []*AggregationType - // the unit of the metric. + // The unit of the metric. Unit *MetricUnit } // MetricDefinitionCollection - Represents collection of metric definitions. type MetricDefinitionCollection struct { - // REQUIRED; the values for the metric definitions. + // REQUIRED; The values for the metric definitions. Value []*MetricDefinition + + // The link to the next page of items + NextLink *string } // MetricDimension - Specifies a metric dimension. @@ -2725,10 +2289,10 @@ type MetricDimension struct { // REQUIRED; Name of the dimension. Name *string - // REQUIRED; the dimension operator. Only 'Include' and 'Exclude' are supported + // REQUIRED; The dimension operator. Only 'Include' and 'Exclude' are supported Operator *string - // REQUIRED; list of dimension values. + // REQUIRED; List of dimension values. Values []*string } @@ -2754,6 +2318,9 @@ type MetricNamespace struct { type MetricNamespaceCollection struct { // REQUIRED; The values for the metric namespaces. Value []*MetricNamespace + + // The link to the next page of items + NextLink *string } // MetricNamespaceName - The fully qualified metric namespace name. @@ -2764,19 +2331,14 @@ type MetricNamespaceName struct { // MetricSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. type MetricSettings struct { - // REQUIRED; a value indicating whether this category is enabled. + // REQUIRED; a value indicating whether this timegrain 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 + // REQUIRED; the timegrain of the metric in ISO8601 format. + TimeGrain *string - // the retention policy for this category. + // the retention policy for this timegrain. RetentionPolicy *RetentionPolicy - - // the timegrain of the metric in ISO8601 format. - TimeGrain *string } // MetricSingleDimension - The metric dimension name and value. @@ -2831,39 +2393,43 @@ type MetricTrigger struct { // MetricValue - Represents a metric value. type MetricValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. + // REQUIRED; The timestamp for the metric value in ISO 8601 format. TimeStamp *time.Time - // the average value in the time range. + // 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 + // 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. + // The greatest value in the time range. Maximum *float64 - // the least value in the time range. + // The least value in the time range. Minimum *float64 - // the sum of all of the values in the time range. + // 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 +// MicrosoftFabricDestination - Microsoft Fabric destination (non-Azure). +type MicrosoftFabricDestination struct { + // The artifact id of the Microsoft Fabric resource. + ArtifactID *string - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string -} + // The name of the database to which data will be ingested. + DatabaseName *string -// MetricsIngestionEndpointSpec - Definition of the endpoint used for ingesting metrics. -type MetricsIngestionEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string + // The ingestion uri of the Microsoft Fabric resource. + IngestionURI *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 tenant id of the Microsoft Fabric resource. + TenantID *string } // MonitoringAccountDestination - Monitoring account destination. @@ -2871,8 +2437,8 @@ 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. + // 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. @@ -2881,7 +2447,7 @@ type MonitoringAccountDestination struct { // MultiMetricCriteria - The types of conditions for a multi resource alert. type MultiMetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria + // REQUIRED; Specifies the type of threshold criteria. Previously undocumented values might be returned CriterionType *CriterionType // REQUIRED; Name of the metric. @@ -2890,36 +2456,112 @@ type MultiMetricCriteria struct { // REQUIRED; Name of the criteria. Name *string - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum + // REQUIRED; The criteria time aggregation types. Previously undocumented values might be returned + TimeAggregation *AggregationTypeEnum + 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 } + +// MultiPromQLCriteria - The types of conditions for a multi query metric alert. +type MultiPromQLCriteria struct { + // REQUIRED; Specifies the type of threshold criteria. Previously undocumented values might be returned + CriterionType *CriterionType + + // REQUIRED; Name of the criteria. + Name *string + + // REQUIRED; The query used to evaluate the alert rule + Query *string +} + +// GetMultiPromQLCriteria implements the MultiPromQLCriteriaClassification interface for type MultiPromQLCriteria. +func (m *MultiPromQLCriteria) GetMultiPromQLCriteria() *MultiPromQLCriteria { return m } + +// NetworkSecurityPerimeter - Information about a network security perimeter (NSP) +type NetworkSecurityPerimeter struct { + // Fully qualified Azure resource ID of the NSP resource + ID *string + + // Location of the network security perimeter + Location *string + + // Universal unique ID (UUID) of the network security perimeter + PerimeterGUID *string +} + +// NetworkSecurityPerimeterConfiguration - Network security perimeter (NSP) configuration resource +type NetworkSecurityPerimeterConfiguration struct { + Properties *NetworkSecurityPerimeterConfigurationProperties + + // 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 +} + +// NetworkSecurityPerimeterConfigurationListResult - Result of a list NSP (network security perimeter) configurations request. +type NetworkSecurityPerimeterConfigurationListResult struct { + // The link used to get the next page of results. + NextLink *string - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any + // Array of network security perimeter results. + Value []*NetworkSecurityPerimeterConfiguration +} - // List of dimension conditions. - Dimensions []*MetricDimension +// NetworkSecurityPerimeterConfigurationProperties - Network security configuration properties. +type NetworkSecurityPerimeterConfigurationProperties struct { + NetworkSecurityPerimeter *NetworkSecurityPerimeter + Profile *NetworkSecurityProfile + ResourceAssociation *ResourceAssociation - // Namespace of the metric. - MetricNamespace *string + // READ-ONLY; List of provisioning issues, if any + ProvisioningIssues []*ProvisioningIssue - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool + // READ-ONLY + ProvisioningState *NetworkSecurityPerimeterConfigurationProvisioningState } -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { return m } +// NetworkSecurityProfile - Network security perimeter configuration profile +type NetworkSecurityProfile struct { + // List of Access Rules + AccessRules []*AccessRule -// 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 + // Current access rules version + AccessRulesVersion *int32 + + // Current diagnostic settings version + DiagnosticSettingsVersion *int32 + + // List of log categories that are enabled + EnabledLogCategories []*string + + // Name of the profile + Name *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 + // 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 @@ -2941,6 +2583,9 @@ type NotificationRequestBody 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 @@ -2957,125 +2602,233 @@ type NotificationRequestBody struct { WebhookReceivers []*WebhookReceiver } -// Operation - Microsoft Insights API operation definition. -type Operation struct { - // Display metadata associated with the operation. - Display *OperationDisplay +// 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 - // Operation name: {provider}/{resource}/{operation} + // The operation name. Name *string + + // Start time of the job in standard ISO8601 format. + StartTime *time.Time + + // The status of the operation. + Status *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 +// OtelLogsDataSource - Enables Otel logs to be collected by this data collection rule. +type OtelLogsDataSource struct { + // REQUIRED; List of streams that this data source will be sent to. + Streams []*KnownOtelLogsDataSourceStreams - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + // Specifies the reference alias to enrich the telemetry signal with. + EnrichWithReference *string - // 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 + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*string - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" + // 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 - // 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 + // Specifies whether to replace the default resourceId in the log record with the resourceId of the referenced resource being + // used for enrichment. + ReplaceResourceIDWithReference *bool + + // Specifies the routing policy based on OTLP payload resource attributes to route subset of the payload according to matching + // resource attribute. + ResourceAttributeRouting *OtelLogsDataSourceResourceAttributeRouting } -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // Operation type: Read, write, delete, etc. - Operation *string +// OtelLogsDataSourceResourceAttributeRouting - Specifies the routing policy based on OTLP payload resource attributes to +// route subset of the payload according to matching resource attribute. +type OtelLogsDataSourceResourceAttributeRouting struct { + // The name of the resource attribute to match. + AttributeName *string - // Service provider: Microsoft.Insights - Provider *string + // The value of the resource attribute to match. + AttributeValue *string +} + +type OtelLogsDirectDataSource struct { + // REQUIRED; List of streams that this data source will be sent to. + Streams []*KnownOtelLogsDirectDataSourceStreams - // Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string + // Specifies the reference to enrich the telemetry signal with. + EnrichWithReference *string + + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*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 + + // Specifies whether to replace the default resourceId in the log record with the resourceId of the referenced resource being + // used for enrichment. + ReplaceResourceIDWithReference *bool } -// 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 +// OtelMetricsDataSource - Definition of OTel metrics configuration. +type OtelMetricsDataSource struct { + // REQUIRED; List of streams that this data source will be sent to. + Streams []*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 + // Specifies the reference to enrich the telemetry signal with. + EnrichWithReference *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*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 + // 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 + + // Specifies the routing policy based on OTLP payload resource attributes to route subset of the payload according to matching + // resource attribute. + ResourceAttributeRouting *OtelMetricsDataSourceResourceAttributeRouting } -// 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 +// OtelMetricsDataSourceResourceAttributeRouting - Specifies the routing policy based on OTLP payload resource attributes +// to route subset of the payload according to matching resource attribute. +type OtelMetricsDataSourceResourceAttributeRouting struct { + // The name of the resource attribute to match. + AttributeName *string - // List of operations supported by the Microsoft.Insights provider. - Value []*Operation + // The value of the resource attribute to match. + AttributeValue *string } -// 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 +// OtelMetricsDirectDataSource - Definition of OTel metrics configuration. +type OtelMetricsDirectDataSource struct { + // REQUIRED; List of streams that this data source will be sent to. + Streams []*string + + // Specifies the reference to enrich the telemetry signal with. + EnrichWithReference *string - // READ-ONLY; List of operations supported by the resource provider - Value []*OperationAutoGenerated + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*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 } -// OperationStatus - The status of operation. -type OperationStatus struct { - // End time of the job in standard ISO8601 format. - EndTime *time.Time +// OtelTracesDataSource - Enables Otel Traces to be collected by this data collection rule. +type OtelTracesDataSource struct { + // REQUIRED; 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 []*KnownOtelTracesDataSourceStreams - // The error detail of the operation if any. - Error *ErrorDetail + // Specifies the reference to enrich the telemetry signal with. + EnrichWithReference *string - // The operation Id. - ID *string + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*string - // The operation name. + // 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 - // Start time of the job in standard ISO8601 format. - StartTime *time.Time + // Specifies whether to replace the default resourceId in the log record with the resourceId of the referenced resource being + // used for enrichment. + ReplaceResourceIDWithReference *bool - // The status of the operation. - Status *string + // Specifies the routing policy based on OTLP payload resource attributes to route subset of the payload according to matching + // resource attribute. + ResourceAttributeRouting *OtelTracesDataSourceResourceAttributeRouting +} + +// OtelTracesDataSourceResourceAttributeRouting - Specifies the routing policy based on OTLP payload resource attributes to +// route subset of the payload according to matching resource attribute. +type OtelTracesDataSourceResourceAttributeRouting struct { + // The name of the resource attribute to match. + AttributeName *string + + // The value of the resource attribute to match. + AttributeValue *string +} + +// OtelTracesDirectDataSource - Enables Otel Traces to be collected by this data collection rule. +type OtelTracesDirectDataSource struct { + // REQUIRED; 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 []*KnownOtelTracesDirectDataSourceStreams + + // Specifies the reference to enrich the telemetry signal with. + EnrichWithReference *string + + // Specifies the list of resource attributes that need to be added as labels/dimensions to the telemetry data for further + // enrichment. + EnrichWithResourceAttributes []*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 + + // Specifies whether to replace the default resourceId in the log record with the resourceId of the referenced resource being + // used for enrichment. + ReplaceResourceIDWithReference *bool } // 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. +// 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'. + // 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. + // 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. + // 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 + + // The KQL query to transform the data source. This is a deprecated property and will be removed in future versions. + TransformKql *string +} + +// PerformanceCountersOTelDataSource - Definition of which Open Telemetry 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 PerformanceCountersOTelDataSource struct { + // A list of specifier names of the performance counters you want to collect. + 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 []*KnownPerformanceCountersOTelDataSourceStreams } // PlatformTelemetryDataSource - Definition of platform telemetry data source configuration @@ -3083,8 +2836,8 @@ 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. + // 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 } @@ -3104,8 +2857,7 @@ type PredictiveResponse struct { 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. + // from what was originally requested. This is not present if a metadata request was made. Interval *string // The metrics being queried @@ -3115,8 +2867,7 @@ type PredictiveResponse struct { 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. + // may be adjusted in the future and returned back from what was originally requested. Timespan *string } @@ -3129,9 +2880,9 @@ type PredictiveValue struct { Value *float64 } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint + // READ-ONLY; The resource identifier of the private endpoint ID *string } @@ -3146,6 +2897,9 @@ type PrivateEndpointConnection struct { // 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 } @@ -3156,12 +2910,12 @@ type PrivateEndpointConnectionListResult struct { Value []*PrivateEndpointConnection } -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. 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. + // The private endpoint resource. PrivateEndpoint *PrivateEndpoint // READ-ONLY; The provisioning state of the private endpoint connection resource. @@ -3179,19 +2933,25 @@ type PrivateLinkResource struct { // 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 } -// PrivateLinkResourceListResult - A list of private link resources +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. type PrivateLinkResourceListResult struct { - // Array of private link resources + // REQUIRED; The PrivateLinkResource items on this page Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string } // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { - // The private link resource Private link DNS zone name. + // The private link resource private link DNS zone name. RequiredZoneNames []*string // READ-ONLY; The private link resource group id. @@ -3223,50 +2983,87 @@ type PrivateLinkServiceConnectionState struct { Status *PrivateEndpointServiceConnectionStatus } +// PromQLCriteria - Specifies the PromQL criteria for the metric alert resource. +type PromQLCriteria struct { + // CONSTANT; Specifies the type of the alert criteria. Previously undocumented values might be returned + // Field has constant value OdatatypeMicrosoftAzureMonitorPromQLCriteria, any specified value is ignored. + ODataType *Odatatype + AdditionalProperties map[string]any + + // The list of promQL criteria. Alert will be raised when all conditions are met. + AllOf []MultiPromQLCriteriaClassification + + // Configuration for failing periods in query-based alerts. + FailingPeriods *QueryFailingPeriods +} + +// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type PromQLCriteria. +func (p *PromQLCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { + return &MetricAlertCriteria{ + AdditionalProperties: p.AdditionalProperties, + ODataType: p.ODataType, + } +} + // 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'. + // Custom VM Scrape Config that defines scrape jobs + CustomVMScrapeConfig []any + + // The list of label inclusion filters in the form of label "name-value" pairs. + // Currently only one label is supported: 'microsoft_metrics_include_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. + // 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 +// ProvisioningIssue - Describes a provisioning issue for a network security perimeter configuration +type ProvisioningIssue struct { + // READ-ONLY; Name of the issue Name *string - // READ-ONLY; Azure resource type - Type *string + // READ-ONLY + Properties *ProvisioningIssueProperties } -// 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 +// ProvisioningIssueProperties - Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource +// providers should generate separate provisioning issue elements for each separate issue detected, and include a meaningful +// and distinctive description, as well as any appropriate suggestedResourceIds and suggestedAccessRules +type ProvisioningIssueProperties struct { + // READ-ONLY; Description of the issue + Description *string - // READ-ONLY; The name of the resource - Name *string + // READ-ONLY; Type of issue + IssueType *IssueType - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // READ-ONLY; Severity of the issue. + Severity *Severity + + // READ-ONLY; Access rules that can be added to the network security profile (NSP) to remediate the issue. + SuggestedAccessRules []*AccessRule + + // READ-ONLY; Fully qualified resource IDs of suggested resources that can be associated to the network security perimeter + // (NSP) to remediate the issue. + SuggestedResourceIDs []*string +} + +// QueryFailingPeriods - Configuration for failing periods in query-based alerts. +type QueryFailingPeriods struct { + // REQUIRED; The amount of time (in ISO 8601 duration format) alert must be active before firing. + For *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. + // 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. @@ -3286,137 +3083,51 @@ type RecurrentSchedule struct { 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 + // 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 + // 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 +// ReferencesSpecEnrichmentData - All the enrichment data sources referenced in data flows +type ReferencesSpecEnrichmentData struct { + // All the storage blobs used as enrichment data sources + StorageBlobs []*StorageBlob } -// 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 +type ResolveConfiguration struct { + // REQUIRED; Indicates whether the alert should be auto resolved + AutoResolved *bool - // READ-ONLY; Azure resource type - Type *string + // The time (in ISO 8601 duration format) after which the alert should be auto resolved + TimeToResolve *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 +// ResourceAssociation - Information about resource association +type ResourceAssociation struct { + AccessMode *ResourceAssociationAccessMode - // READ-ONLY; The name of the resource + // Name of the resource association 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. @@ -3430,14 +3141,10 @@ type ResourceForUpdate struct { // ResourceForUpdateIdentity - Managed Service Identity. type ResourceForUpdateIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. 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. + // The identities assigned to this resource by the user. 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 @@ -3451,19 +3158,19 @@ type ResourceForUpdateIdentity struct { // 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. + // '/'. This may be adjusted in the future and returned back from what was originally requested. Timespan *string - // REQUIRED; the value of the collection. + // 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. + // The interval (window size) for which the metric data was returned in ISO 8601 duration format with a special case for 'FULL' + // value that returns single datapoint for entire time span requested (*Examples: PT15M, PT1H, P1D, FULL*). + // This may be adjusted and different from what was originally requested if AutoAdjustTimegrain=true is specified. This is + // not present if a metadata request was made. Interval *string // The namespace of the metrics being queried @@ -3473,181 +3180,13 @@ type Response struct { 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, - } + // REQUIRED; a value indicating whether the retention policy is enabled. + Enabled *bool } // RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. @@ -3660,26 +3199,6 @@ type RuleResolveConfiguration struct { 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 @@ -3745,7 +3264,7 @@ type ScheduledQueryRuleProperties struct { 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. + // 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. @@ -3776,11 +3295,8 @@ type ScheduledQueryRuleProperties struct { // 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 + // Defines the configuration for resolving fired alerts. Relevant only for rules of kinds LogAlert and SimpleLogAlert. + ResolveConfiguration *RuleResolveConfiguration // The list of resource id's that this scheduled query rule is scoped to. Scopes []*string @@ -3794,9 +3310,8 @@ type ScheduledQueryRuleProperties struct { 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 + // 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 @@ -3831,10 +3346,7 @@ type ScheduledQueryRuleResource struct { // 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. + // READ-ONLY; Resource entity tag (ETag). Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -3843,7 +3355,7 @@ type ScheduledQueryRuleResource struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; SystemData of ScheduledQueryRule. + // 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" @@ -3852,10 +3364,10 @@ type ScheduledQueryRuleResource struct { // ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. type ScheduledQueryRuleResourceCollection struct { - // The values for the scheduled query rule resources. + // REQUIRED; The ScheduledQueryRuleResource items on this page Value []*ScheduledQueryRuleResource - // READ-ONLY; Provides the link to retrieve the next set of elements. + // The link to the next page of items NextLink *string } @@ -3882,29 +3394,35 @@ type ScopedResource struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; System data + // 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 } -// ScopedResourceListResult - A list of scoped resources in a private link scope. +// ScopedResourceListResult - The response of a ScopedResource list operation. type ScopedResourceListResult struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string - - // READ-ONLY; Array of results. + // REQUIRED; The ScopedResource items on this page Value []*ScopedResource + + // The link to the next page of items + NextLink *string } // ScopedResourceProperties - Properties of a private link scoped resource. type ScopedResourceProperties struct { + // The kind of scoped Azure monitor resource. + Kind *ScopedResourceKind + // The resource id of the scoped Azure monitor resource. LinkedResourceID *string - // READ-ONLY; State of the private endpoint connection. - ProvisioningState *string + // The location of a scoped subscription. Only needs to be specified for metric dataplane subscriptions. + SubscriptionLocation *string + + // READ-ONLY; State of the Azure monitor resource. + ProvisioningState *ScopedResourceProvisioningState } // SenderAuthorization - the authorization used by the user who has performed the operation that led to this event. This captures @@ -3920,6 +3438,62 @@ type SenderAuthorization struct { Scope *string } +// ServiceDiagnosticSettings - The diagnostic settings for service. +type ServiceDiagnosticSettings struct { + // The resource Id for the event hub namespace authorization rule. + EventHubAuthorizationRuleID *string + + // the list of logs settings. + Logs []*LogSettings + + // the list of metric settings. + Metrics []*MetricSettings + + // The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic + // Logs. 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 Diagnostic Logs. + StorageAccountID *string + + // The workspace ID (resource ID of a Log Analytics workspace) for a 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 +} + +// ServiceDiagnosticSettingsResource - Description of a service diagnostic setting +type ServiceDiagnosticSettingsResource struct { + // REQUIRED; Resource location + Location *string + + // The service diagnostics settings of the resource. + Properties *ServiceDiagnosticSettings + + // 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 +} + +// ServiceDiagnosticSettingsResourcePatch - Service diagnostic setting resource for patch operations +type ServiceDiagnosticSettingsResourcePatch struct { + // The service diagnostics settings for an update operation. + Properties *ServiceDiagnosticSettings + + // Resource tags + Tags map[string]*string +} + // SingleBaseline - The baseline values for a single sensitivity value. type SingleBaseline struct { // REQUIRED; The high thresholds of the baseline. @@ -3962,27 +3536,48 @@ type SmsReceiver struct { Status *ReceiverStatus } -// SmsReceiverAutoGenerated - An SMS receiver. -type SmsReceiverAutoGenerated struct { - // REQUIRED; The country code of the SMS receiver. - CountryCode *string +// StaticPromQLCriteria - The criterion for static prom query. +type StaticPromQLCriteria struct { + // CONSTANT; Specifies the type of threshold criteria. Previously undocumented values might be returned + // Field has constant value CriterionTypeStaticThresholdCriterion, any specified value is ignored. + CriterionType *CriterionType - // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within a tenant action group. + // REQUIRED; Name of the criteria. Name *string - // REQUIRED; The phone number of the SMS receiver. - PhoneNumber *string + // REQUIRED; The query used to evaluate the alert rule + Query *string +} - // READ-ONLY; The status of the receiver. - Status *ReceiverStatus +// GetMultiPromQLCriteria implements the MultiPromQLCriteriaClassification interface for type StaticPromQLCriteria. +func (s *StaticPromQLCriteria) GetMultiPromQLCriteria() *MultiPromQLCriteria { + return &MultiPromQLCriteria{ + CriterionType: s.CriterionType, + Name: s.Name, + Query: s.Query, + } +} + +type StorageBlob struct { + // Url of the storage blob + BlobURL *string + + // The type of lookup to perform on the blob + LookupType *KnownStorageBlobLookupType + + // The name of the enrichment data source used as an alias when referencing this data source in data flows + Name *string + + // Resource Id of the storage account that hosts the blob + ResourceID *string } 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. + // 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. @@ -3990,8 +3585,8 @@ type StorageBlobDestination struct { } 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. + // 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. @@ -4007,72 +3602,45 @@ type StreamDeclaration struct { 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 - - // 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 *MetricUnit - - // 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 -} - // SubscriptionScopeMetricDefinition - Metric definition class specifies the metadata for a metric. type SubscriptionScopeMetricDefinition 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. + // 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. + // 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. + // 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. + // The name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString - // the namespace the metric belongs to. + // The namespace the metric belongs to. Namespace *string - // the primary aggregation type value defining how to use the values for display. + // The primary aggregation type value defining how to use the values for display. PrimaryAggregationType *MetricAggregationType - // the resource identifier of the resource that emitted the metric. + // The resource identifier of the resource that emitted the metric. ResourceID *string - // the collection of what aggregation types are supported. + // The collection of what aggregation types are supported. SupportedAggregationTypes []*MetricAggregationType - // the unit of the metric. + // The unit of the metric. Unit *MetricUnit } @@ -4080,31 +3648,9 @@ type SubscriptionScopeMetricDefinition struct { type SubscriptionScopeMetricDefinitionCollection struct { // REQUIRED; The values for the metric definitions. Value []*SubscriptionScopeMetricDefinition -} - -// 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 - - // 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 + // The link to the next page of items + NextLink *string } // SubscriptionScopeMetricsRequestBodyParameters - Query parameters can also be specified in the body, specifying the same @@ -4114,25 +3660,20 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { 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. + // 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 ‘’. + // 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. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested. + // *Examples: PT15M, PT1H, P1D, FULL* Interval *string // The names of the metrics (comma separated) to retrieve. @@ -4141,22 +3682,25 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { // 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. + // 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. + // 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 timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // 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 @@ -4164,8 +3708,8 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { ValidateDimensions *bool } -// SyslogDataSource - Definition of which syslog data will be collected and how it will be collected. Only collected from -// Linux machines. +// 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 @@ -4173,13 +3717,17 @@ type SyslogDataSource struct { // The log levels to collect. LogLevels []*KnownSyslogDataSourceLogLevels - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. + // 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. + // 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 + + // The KQL query to transform the data source. This is a deprecated property and will be removed in future versions. + TransformKql *string } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -4210,61 +3758,6 @@ type TagsResource struct { 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 @@ -4283,39 +3776,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. @@ -4339,7 +3799,7 @@ 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. + // The metadata values returned if $filter was specified in the call. Metadatavalues []*MetadataValue } @@ -4352,77 +3812,31 @@ type TimeWindow struct { 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, + // 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 + // 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. @@ -4432,47 +3846,15 @@ type UserAssignedIdentity struct { PrincipalID *string } -// UserIdentityProperties - User assigned identity properties. +// UserIdentityProperties - Properties of the user assigned identity. type UserIdentityProperties struct { - // READ-ONLY; The client id of user assigned identity. + // READ-ONLY; The client ID of resource identity. ClientID *string - // READ-ONLY; The principal id of user assigned identity. + // READ-ONLY; The principal ID of resource identity. 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. @@ -4485,18 +3867,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. @@ -4517,29 +3887,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 @@ -4562,13 +3911,12 @@ type WebtestLocationAvailabilityCriteria struct { // REQUIRED; The number of failed locations. FailedLocationCount *float32 - // REQUIRED; specifies the type of the alert criteria. + // CONSTANT; Specifies the type of the alert criteria. Previously undocumented values might be returned + // Field has constant value OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria, any specified value is ignored. ODataType *Odatatype // REQUIRED; The Application Insights web test Id. - WebTestID *string - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. + WebTestID *string AdditionalProperties map[string]any } @@ -4583,14 +3931,18 @@ func (w *WebtestLocationAvailabilityCriteria) GetMetricAlertCriteria() *MetricAl // 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. + // 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. + // 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 + // The KQL query to transform the data source. This is a deprecated property and will be removed in future versions. + TransformKql *string + // A list of Windows Event Log queries in XPATH format. XPathQueries []*string } @@ -4600,25 +3952,10 @@ 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. + // 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 + // Firewall logs profile filter + ProfileFilter []*KnownWindowsFirewallLogsDataSourceProfileFilter } diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index 65386fd2a973..2a8e3a481f0c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -9,6 +8,7 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/datetime" "reflect" "time" ) @@ -83,6 +83,115 @@ func (a *AccessModeSettingsExclusion) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccessRule. +func (a AccessRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRule. +func (a *AccessRule) UnmarshalJSON(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) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + 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 AccessRuleProperties. +func (a AccessRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefixes", a.AddressPrefixes) + populate(objectMap, "direction", a.Direction) + populate(objectMap, "emailAddresses", a.EmailAddresses) + populate(objectMap, "fullyQualifiedDomainNames", a.FullyQualifiedDomainNames) + populate(objectMap, "networkSecurityPerimeters", a.NetworkSecurityPerimeters) + populate(objectMap, "phoneNumbers", a.PhoneNumbers) + populate(objectMap, "subscriptions", a.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRuleProperties. +func (a *AccessRuleProperties) UnmarshalJSON(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 "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &a.AddressPrefixes) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &a.Direction) + delete(rawMsg, key) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &a.EmailAddresses) + delete(rawMsg, key) + case "fullyQualifiedDomainNames": + err = unpopulate(val, "FullyQualifiedDomainNames", &a.FullyQualifiedDomainNames) + delete(rawMsg, key) + case "networkSecurityPerimeters": + err = unpopulate(val, "NetworkSecurityPerimeters", &a.NetworkSecurityPerimeters) + delete(rawMsg, key) + case "phoneNumbers": + err = unpopulate(val, "PhoneNumbers", &a.PhoneNumbers) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &a.Subscriptions) + 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 AccessRulePropertiesSubscriptionsItem. +func (a AccessRulePropertiesSubscriptionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRulePropertiesSubscriptionsItem. +func (a *AccessRulePropertiesSubscriptionsItem) UnmarshalJSON(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) + } + 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) @@ -141,6 +250,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) @@ -182,6 +292,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) @@ -205,37 +318,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) @@ -294,36 +376,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) @@ -338,37 +394,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) @@ -387,9 +415,11 @@ 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) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) @@ -407,6 +437,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) @@ -416,6 +449,9 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { 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) @@ -461,6 +497,7 @@ func (a *ActionList) UnmarshalJSON(data []byte) error { 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) } @@ -477,6 +514,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) @@ -488,6 +528,41 @@ func (a *Actions) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertActionGroup. +func (a ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionGroupId", a.ActionGroupID) + populate(objectMap, "actionProperties", a.ActionProperties) + populate(objectMap, "webhookProperties", a.WebhookProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityLogAlertActionGroup. +func (a *ActivityLogAlertActionGroup) UnmarshalJSON(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 "actionProperties": + err = unpopulate(val, "ActionProperties", &a.ActionProperties) + 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 ActivityLogAlertResource. func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -495,6 +570,7 @@ func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { 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) @@ -521,6 +597,9 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { 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) @@ -535,22 +614,18 @@ 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 AdxDestination. +func (a AdxDestination) 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, "databaseName", a.DatabaseName) + populate(objectMap, "ingestionUri", a.IngestionURI) populate(objectMap, "name", a.Name) - populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceId", a.ResourceID) 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 AdxDestination. +func (a *AdxDestination) UnmarshalJSON(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) @@ -558,29 +633,48 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "action": - a.Action, err = unmarshalRuleActionClassification(val) - delete(rawMsg, key) - case "actions": - a.Actions, err = unmarshalRuleActionClassificationArray(val) - delete(rawMsg, key) - case "condition": - a.Condition, err = unmarshalRuleConditionClassification(val) + case "databaseName": + err = unpopulate(val, "DatabaseName", &a.DatabaseName) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) + case "ingestionUri": + err = unpopulate(val, "IngestionURI", &a.IngestionURI) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) 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 AgentSetting. +func (a AgentSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentSetting. +func (a *AgentSetting) UnmarshalJSON(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) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { @@ -788,6 +882,7 @@ func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "description", a.Description) populate(objectMap, "enabled", a.Enabled) populate(objectMap, "scopes", a.Scopes) + populate(objectMap, "tenantScope", a.TenantScope) return json.Marshal(objectMap) } @@ -815,6 +910,9 @@ func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { case "scopes": err = unpopulate(val, "Scopes", &a.Scopes) delete(rawMsg, key) + case "tenantScope": + err = unpopulate(val, "TenantScope", &a.TenantScope) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -823,20 +921,16 @@ func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { 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 ApplicationInsights. +func (a ApplicationInsights) 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, "resourceId", a.ResourceID) 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 ApplicationInsights. +func (a *ApplicationInsights) UnmarshalJSON(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) @@ -844,81 +938,11 @@ func (a *AlertRuleResource) 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) - 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 AlertRuleResourceCollection. -func (a AlertRuleResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceCollection. -func (a *AlertRuleResourceCollection) UnmarshalJSON(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 "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 AlertRuleResourcePatch. -func (a AlertRuleResourcePatch) 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 AlertRuleResourcePatch. -func (a *AlertRuleResourcePatch) UnmarshalJSON(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) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) delete(rawMsg, key) } if err != nil { @@ -968,6 +992,7 @@ func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "automationAccountId", a.AutomationAccountID) populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) + populate(objectMap, "managedIdentity", a.ManagedIdentity) populate(objectMap, "name", a.Name) populate(objectMap, "runbookName", a.RunbookName) populate(objectMap, "serviceUri", a.ServiceURI) @@ -991,6 +1016,9 @@ func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { case "isGlobalRunbook": err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) @@ -1014,76 +1042,6 @@ func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponse. -func (a AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", a.Error) - populate(objectMap, "systemData", a.SystemData) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponse. -func (a *AutoscaleErrorResponse) UnmarshalJSON(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 "error": - err = unpopulate(val, "Error", &a.Error) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - 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 AutoscaleErrorResponseError. -func (a AutoscaleErrorResponseError) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponseError. -func (a *AutoscaleErrorResponseError) UnmarshalJSON(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 "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &a.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &a.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &a.Target) - 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 AutoscaleNotification. func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1357,43 +1315,13 @@ func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { 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, "managedIdentity", a.ManagedIdentity) populate(objectMap, "name", a.Name) populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) return json.Marshal(objectMap) @@ -1417,6 +1345,9 @@ func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { case "httpTriggerUrl": err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) @@ -1431,33 +1362,6 @@ func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { 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) @@ -1575,557 +1479,518 @@ func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspace. -func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. +func (b BaselineMetadata) 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) + populate(objectMap, "name", b.Name) + populate(objectMap, "value", b.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspace. -func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { +// 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, 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) + case "name": + err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "value": + err = unpopulate(val, "Value", &b.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a AzureMonitorWorkspaceDefaultIngestionSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. +func (c ColumnDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", a.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", a.DataCollectionRuleResourceID) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a *AzureMonitorWorkspaceDefaultIngestionSettings) UnmarshalJSON(data []byte) error { +// 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &a.DataCollectionEndpointResourceID) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &a.DataCollectionRuleResourceID) + case "type": + err = unpopulate(val, "Type", &c.Type) 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 AzureMonitorWorkspaceMetrics. -func (a AzureMonitorWorkspaceMetrics) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Condition. +func (c Condition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "internalId", a.InternalID) - populate(objectMap, "prometheusQueryEndpoint", a.PrometheusQueryEndpoint) + populate(objectMap, "alertSensitivity", c.AlertSensitivity) + populate(objectMap, "criterionType", c.CriterionType) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "failingPeriods", c.FailingPeriods) + populateTime[datetime.RFC3339](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 AzureMonitorWorkspaceMetrics. -func (a *AzureMonitorWorkspaceMetrics) 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 "internalId": - err = unpopulate(val, "InternalID", &a.InternalID) + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &c.AlertSensitivity) + delete(rawMsg, key) + 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 = unpopulateTime[datetime.RFC3339](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 "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &a.PrometheusQueryEndpoint) + 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 AzureMonitorWorkspaceResource. -func (a AzureMonitorWorkspaceResource) 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, "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) + populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResource. -func (a *AzureMonitorWorkspaceResource) 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 "etag": - err = unpopulate(val, "Etag", &a.Etag) + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) 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) + 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 AzureMonitorWorkspaceResourceForUpdate. -func (a AzureMonitorWorkspaceResourceForUpdate) 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, "tags", a.Tags) + populate(objectMap, "contextType", c.ContextType) + populate(objectMap, "notificationSource", c.NotificationSource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceForUpdate. -func (a *AzureMonitorWorkspaceResourceForUpdate) 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 "tags": - err = unpopulate(val, "Tags", &a.Tags) + 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 AzureMonitorWorkspaceResourceListResult. -func (a AzureMonitorWorkspaceResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. +func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "endpoint", d.Endpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceListResult. -func (a *AzureMonitorWorkspaceResourceListResult) UnmarshalJSON(data []byte) error { +// 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", a, err) + 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", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) 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 AzureMonitorWorkspaceResourceProperties. -func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointFailoverConfiguration. +func (d DataCollectionEndpointFailoverConfiguration) 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) + populate(objectMap, "activeLocation", d.ActiveLocation) + populate(objectMap, "locations", d.Locations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceProperties. -func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) error { +// 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", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, 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) + case "activeLocation": + err = unpopulate(val, "ActiveLocation", &d.ActiveLocation) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "locations": + err = unpopulate(val, "Locations", &d.Locations) 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 AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. +func (d DataCollectionEndpointLogsIngestion) 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) + populate(objectMap, "endpoint", d.Endpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. -func (a *AzureResource) UnmarshalJSON(data []byte) error { +// 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", a, err) + 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", &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) + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) 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 AzureResourceAutoGenerated. -func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetadata. +func (d DataCollectionEndpointMetadata) 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) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) + populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceAutoGenerated. -func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { +// 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", a, err) + 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", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "provisionedByResourceId": + err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) 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 BaselineMetadata. -func (b BaselineMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetricsIngestion. +func (d DataCollectionEndpointMetricsIngestion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", b.Name) - populate(objectMap, "value", b.Value) + populate(objectMap, "endpoint", d.Endpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineMetadata. -func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { +// 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", b, err) + 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", &b.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. -func (c ColumnDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. +func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ColumnDefinition. -func (c *ColumnDefinition) UnmarshalJSON(data []byte) error { +// 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", c, err) + 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", &c.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. +func (d DataCollectionEndpointResource) 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) + 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, "sku", d.SKU) + 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 Condition. -func (c *Condition) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &c.Dimensions) + case "etag": + err = unpopulate(val, "Etag", &d.Etag) delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "metricMeasureColumn": - err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &c.MetricName) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &c.Operator) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "resourceIdColumn": - err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &c.Threshold) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. -func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceIdentity. +func (d DataCollectionEndpointResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) + 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 ConditionFailingPeriods. -func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { +// 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", c, err) + 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", &c.MinFailingPeriodsToAlert) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) 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) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Context. -func (c Context) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. +func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "contextType", c.ContextType) - populate(objectMap, "notificationSource", c.NotificationSource) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Context. -func (c *Context) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "contextType": - err = unpopulate(val, "ContextType", &c.ContextType) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "notificationSource": - err = unpopulate(val, "NotificationSource", &c.NotificationSource) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpoint. -func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { +// 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) @@ -2140,8 +2005,8 @@ func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpoint. -func (d *DataCollectionEndpoint) UnmarshalJSON(data []byte) error { +// 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) @@ -2187,15 +2052,19 @@ func (d *DataCollectionEndpoint) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSKU. +func (d DataCollectionEndpointResourceSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) + populate(objectMap, "capacity", d.Capacity) + populate(objectMap, "family", d.Family) + populate(objectMap, "name", d.Name) + populate(objectMap, "size", d.Size) + populate(objectMap, "tier", d.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceSKU. +func (d *DataCollectionEndpointResourceSKU) UnmarshalJSON(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) @@ -2203,8 +2072,20 @@ func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) + case "capacity": + err = unpopulate(val, "Capacity", &d.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &d.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &d.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &d.Tier) delete(rawMsg, key) } if err != nil { @@ -2214,16 +2095,15 @@ func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d DataCollectionEndpointFailoverConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAgentSettings. +func (d DataCollectionRuleAgentSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "activeLocation", d.ActiveLocation) - populate(objectMap, "locations", d.Locations) + populate(objectMap, "logs", d.Logs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d *DataCollectionEndpointFailoverConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAgentSettings. +func (d *DataCollectionRuleAgentSettings) UnmarshalJSON(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) @@ -2231,11 +2111,8 @@ func (d *DataCollectionEndpointFailoverConfiguration) UnmarshalJSON(data []byte) 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) + case "logs": + err = unpopulate(val, "Logs", &d.Logs) delete(rawMsg, key) } if err != nil { @@ -2245,15 +2122,17 @@ func (d *DataCollectionEndpointFailoverConfiguration) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. -func (d DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. +func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) + populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointLogsIngestion. -func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { +// 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) @@ -2261,8 +2140,14 @@ func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + delete(rawMsg, key) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) + delete(rawMsg, key) + case "provisionedByResourceId": + err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) delete(rawMsg, key) } if err != nil { @@ -2272,16 +2157,20 @@ func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetadata. -func (d DataCollectionEndpointMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. +func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) + 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 DataCollectionEndpointMetadata. -func (d *DataCollectionEndpointMetadata) UnmarshalJSON(data []byte) error { +// 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) @@ -2289,11 +2178,23 @@ func (d *DataCollectionEndpointMetadata) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + case "etag": + err = unpopulate(val, "Etag", &d.Etag) delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) + 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 { @@ -2303,15 +2204,16 @@ func (d *DataCollectionEndpointMetadata) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d DataCollectionEndpointMetricsIngestion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. +func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d *DataCollectionEndpointMetricsIngestion) UnmarshalJSON(data []byte) error { +// 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) @@ -2319,8 +2221,11 @@ func (d *DataCollectionEndpointMetricsIngestion) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) + 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 { @@ -2330,15 +2235,19 @@ func (d *DataCollectionEndpointMetricsIngestion) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. -func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. +func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + 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 DataCollectionEndpointNetworkACLs. -func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { +// 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) @@ -2346,8 +2255,20 @@ func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + 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 { @@ -2357,24 +2278,29 @@ func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. -func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. +func (d DataCollectionRuleDataSources) 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) + populate(objectMap, "dataImports", d.DataImports) + populate(objectMap, "etwProviders", d.EtwProviders) + populate(objectMap, "extensions", d.Extensions) + populate(objectMap, "iisLogs", d.IisLogs) + populate(objectMap, "logFiles", d.LogFiles) + populate(objectMap, "otelLogs", d.OtelLogs) + populate(objectMap, "otelMetrics", d.OtelMetrics) + populate(objectMap, "otelTraces", d.OtelTraces) + populate(objectMap, "performanceCounters", d.PerformanceCounters) + populate(objectMap, "performanceCountersOTel", d.PerformanceCountersOTel) + 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 DataCollectionEndpointResource. -func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { +// 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) @@ -2382,35 +2308,50 @@ func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { 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) + case "dataImports": + err = unpopulate(val, "DataImports", &d.DataImports) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) + case "etwProviders": + err = unpopulate(val, "EtwProviders", &d.EtwProviders) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) + case "extensions": + err = unpopulate(val, "Extensions", &d.Extensions) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) + case "iisLogs": + err = unpopulate(val, "IisLogs", &d.IisLogs) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "logFiles": + err = unpopulate(val, "LogFiles", &d.LogFiles) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "otelLogs": + err = unpopulate(val, "OtelLogs", &d.OtelLogs) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "otelMetrics": + err = unpopulate(val, "OtelMetrics", &d.OtelMetrics) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "otelTraces": + err = unpopulate(val, "OtelTraces", &d.OtelTraces) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "performanceCounters": + err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) + delete(rawMsg, key) + case "performanceCountersOTel": + err = unpopulate(val, "PerformanceCountersOTel", &d.PerformanceCountersOTel) + 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 { @@ -2420,18 +2361,24 @@ func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceIdentity. -func (d DataCollectionEndpointResourceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. +func (d DataCollectionRuleDestinations) 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) + populate(objectMap, "azureDataExplorer", d.AzureDataExplorer) + populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) + populate(objectMap, "eventHubs", d.EventHubs) + populate(objectMap, "eventHubsDirect", d.EventHubsDirect) + populate(objectMap, "logAnalytics", d.LogAnalytics) + populate(objectMap, "microsoftFabric", d.MicrosoftFabric) + 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 DataCollectionEndpointResourceIdentity. -func (d *DataCollectionEndpointResourceIdentity) UnmarshalJSON(data []byte) error { +// 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) @@ -2439,17 +2386,35 @@ func (d *DataCollectionEndpointResourceIdentity) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) + case "azureDataExplorer": + err = unpopulate(val, "AzureDataExplorer", &d.AzureDataExplorer) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &d.TenantID) + case "azureMonitorMetrics": + err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "eventHubs": + err = unpopulate(val, "EventHubs", &d.EventHubs) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &d.UserAssignedIdentities) + case "eventHubsDirect": + err = unpopulate(val, "EventHubsDirect", &d.EventHubsDirect) + delete(rawMsg, key) + case "logAnalytics": + err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) + delete(rawMsg, key) + case "microsoftFabric": + err = unpopulate(val, "MicrosoftFabric", &d.MicrosoftFabric) + 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 { @@ -2459,16 +2424,17 @@ func (d *DataCollectionEndpointResourceIdentity) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. -func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDirectDataSources. +func (d DataCollectionRuleDirectDataSources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "otelLogs", d.OtelLogs) + populate(objectMap, "otelMetrics", d.OtelMetrics) + populate(objectMap, "otelTraces", d.OtelTraces) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceListResult. -func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDirectDataSources. +func (d *DataCollectionRuleDirectDataSources) UnmarshalJSON(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) @@ -2476,11 +2442,14 @@ func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "otelLogs": + err = unpopulate(val, "OtelLogs", &d.OtelLogs) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "otelMetrics": + err = unpopulate(val, "OtelMetrics", &d.OtelMetrics) + delete(rawMsg, key) + case "otelTraces": + err = unpopulate(val, "OtelTraces", &d.OtelTraces) delete(rawMsg, key) } if err != nil { @@ -2490,24 +2459,16 @@ func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceProperties. -func (d DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleEndpoints. +func (d DataCollectionRuleEndpoints) 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 { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleEndpoints. +func (d *DataCollectionRuleEndpoints) UnmarshalJSON(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) @@ -2515,83 +2476,12 @@ func (d *DataCollectionEndpointResourceProperties) UnmarshalJSON(data []byte) er 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) @@ -2600,23 +2490,15 @@ func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. -func (d DataCollectionRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleIngestionQuotas. +func (d DataCollectionRuleIngestionQuotas) 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) + populate(objectMap, "logs", d.Logs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRule. -func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleIngestionQuotas. +func (d *DataCollectionRuleIngestionQuotas) UnmarshalJSON(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) @@ -2624,32 +2506,8 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { 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) + case "logs": + err = unpopulate(val, "Logs", &d.Logs) delete(rawMsg, key) } if err != nil { @@ -2659,19 +2517,17 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. -func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. +func (d DataCollectionRuleMetadata) 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) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + populate(objectMap, "provisionedByImmutableId", d.ProvisionedByImmutableID) + populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociation. -func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { +// 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) @@ -2679,20 +2535,14 @@ func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { 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) + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) + case "provisionedByImmutableId": + err = unpopulate(val, "ProvisionedByImmutableID", &d.ProvisionedByImmutableID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "provisionedByResourceId": + err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) delete(rawMsg, key) } if err != nil { @@ -2702,16 +2552,16 @@ func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. -func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleReferences. +func (d DataCollectionRuleReferences) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) + populate(objectMap, "applicationInsights", d.ApplicationInsights) + populate(objectMap, "enrichmentData", d.EnrichmentData) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationMetadata. -func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleReferences. +func (d *DataCollectionRuleReferences) UnmarshalJSON(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) @@ -2719,11 +2569,11 @@ func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + case "applicationInsights": + err = unpopulate(val, "ApplicationInsights", &d.ApplicationInsights) delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) + case "enrichmentData": + err = unpopulate(val, "EnrichmentData", &d.EnrichmentData) delete(rawMsg, key) } if err != nil { @@ -2733,20 +2583,25 @@ func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. -func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { +// 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, "sku", d.SKU) 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 DataCollectionRuleAssociationProxyOnlyResource. -func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []byte) error { +// 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) @@ -2760,16 +2615,31 @@ func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []by 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 "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) - case "type": + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } @@ -2780,16 +2650,55 @@ func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []by return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { +// 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 DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) UnmarshalJSON(data []byte) error { +// 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) @@ -2811,19 +2720,28 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. +func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentSettings", d.AgentSettings) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) + populate(objectMap, "dataFlows", d.DataFlows) + populate(objectMap, "dataSources", d.DataSources) populate(objectMap, "description", d.Description) + populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "directDataSources", d.DirectDataSources) + populate(objectMap, "endpoints", d.Endpoints) + populate(objectMap, "immutableId", d.ImmutableID) + populate(objectMap, "ingestionQuotas", d.IngestionQuotas) populate(objectMap, "metadata", d.Metadata) populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "references", d.References) + populate(objectMap, "streamDeclarations", d.StreamDeclarations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -2831,21 +2749,48 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON for key, val := range rawMsg { var err error switch key { + case "agentSettings": + err = unpopulate(val, "AgentSettings", &d.AgentSettings) + delete(rawMsg, key) case "dataCollectionEndpointId": err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) delete(rawMsg, key) - case "dataCollectionRuleId": - err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) + 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 "directDataSources": + err = unpopulate(val, "DirectDataSources", &d.DirectDataSources) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &d.Endpoints) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &d.ImmutableID) + delete(rawMsg, key) + case "ingestionQuotas": + err = unpopulate(val, "IngestionQuotas", &d.IngestionQuotas) + 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 "references": + err = unpopulate(val, "References", &d.References) + 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) @@ -2854,20 +2799,19 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSKU. +func (d DataCollectionRuleResourceSKU) 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) + populate(objectMap, "capacity", d.Capacity) + populate(objectMap, "family", d.Family) + populate(objectMap, "name", d.Name) + populate(objectMap, "size", d.Size) + populate(objectMap, "tier", d.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceSKU. +func (d *DataCollectionRuleResourceSKU) UnmarshalJSON(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) @@ -2875,23 +2819,20 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON 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) + case "capacity": + err = unpopulate(val, "Capacity", &d.Capacity) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) + case "family": + err = unpopulate(val, "Family", &d.Family) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + case "size": + err = unpopulate(val, "Size", &d.Size) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + case "tier": + err = unpopulate(val, "Tier", &d.Tier) delete(rawMsg, key) } if err != nil { @@ -2901,24 +2842,20 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. -func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataFlow. +func (d DataFlow) 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) + populate(objectMap, "builtInTransform", d.BuiltInTransform) + populate(objectMap, "captureOverflow", d.CaptureOverflow) + 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 DataCollectionRuleDataSources. -func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { +// 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) @@ -2926,35 +2863,23 @@ func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { 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) + case "builtInTransform": + err = unpopulate(val, "BuiltInTransform", &d.BuiltInTransform) delete(rawMsg, key) - case "platformTelemetry": - err = unpopulate(val, "PlatformTelemetry", &d.PlatformTelemetry) + case "captureOverflow": + err = unpopulate(val, "CaptureOverflow", &d.CaptureOverflow) delete(rawMsg, key) - case "prometheusForwarder": - err = unpopulate(val, "PrometheusForwarder", &d.PrometheusForwarder) + case "destinations": + err = unpopulate(val, "Destinations", &d.Destinations) delete(rawMsg, key) - case "syslog": - err = unpopulate(val, "Syslog", &d.Syslog) + case "outputStream": + err = unpopulate(val, "OutputStream", &d.OutputStream) delete(rawMsg, key) - case "windowsEventLogs": - err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) + case "streams": + err = unpopulate(val, "Streams", &d.Streams) delete(rawMsg, key) - case "windowsFirewallLogs": - err = unpopulate(val, "WindowsFirewallLogs", &d.WindowsFirewallLogs) + case "transformKql": + err = unpopulate(val, "TransformKql", &d.TransformKql) delete(rawMsg, key) } if err != nil { @@ -2964,22 +2889,17 @@ func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. -func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataImportSourcesEventHub. +func (d DataImportSourcesEventHub) 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) + 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 DataCollectionRuleDestinations. -func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { +// 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) @@ -2987,29 +2907,14 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { 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) + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &d.ConsumerGroup) delete(rawMsg, key) - case "storageBlobsDirect": - err = unpopulate(val, "StorageBlobsDirect", &d.StorageBlobsDirect) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "storageTablesDirect": - err = unpopulate(val, "StorageTablesDirect", &d.StorageTablesDirect) + case "stream": + err = unpopulate(val, "Stream", &d.Stream) delete(rawMsg, key) } if err != nil { @@ -3019,16 +2924,15 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. -func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpecDataImports. +func (d DataSourcesSpecDataImports) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) + populate(objectMap, "eventHub", d.EventHub) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. -func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { +// 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) @@ -3036,11 +2940,8 @@ func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { 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) + case "eventHub": + err = unpopulate(val, "EventHub", &d.EventHub) delete(rawMsg, key) } if err != nil { @@ -3050,24 +2951,15 @@ func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. -func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DestinationsSpecAzureMonitorMetrics. +func (d DestinationsSpecAzureMonitorMetrics) 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 { +// 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) @@ -3075,165 +2967,9 @@ func (d *DataCollectionRuleResource) UnmarshalJSON(data []byte) error { 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) @@ -3242,20 +2978,17 @@ func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. -func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) 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) + 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 DataCollectionRuleResourceSystemData. -func (d *DataCollectionRuleResourceSystemData) 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", d, err) @@ -3263,23 +2996,14 @@ func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error 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) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + case "values": + err = unpopulate(val, "Values", &d.Values) delete(rawMsg, key) } if err != nil { @@ -3289,46 +3013,30 @@ func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DataContainer. -func (d DataContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. +func (d DynamicMetricCriteria) 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) + populate(objectMap, "alertSensitivity", d.AlertSensitivity) + objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion + populate(objectMap, "dimensions", d.Dimensions) + populate(objectMap, "failingPeriods", d.FailingPeriods) + populateTime[datetime.RFC3339](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 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 { +// 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) @@ -3336,1051 +3044,146 @@ func (d *DataFlow) UnmarshalJSON(data []byte) error { 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) + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) delete(rawMsg, key) - case "outputStream": - err = unpopulate(val, "OutputStream", &d.OutputStream) + case "criterionType": + err = unpopulate(val, "CriterionType", &d.CriterionType) delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &d.Streams) + case "dimensions": + err = unpopulate(val, "Dimensions", &d.Dimensions) delete(rawMsg, key) - case "transformKql": - err = unpopulate(val, "TransformKql", &d.TransformKql) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &d.FailingPeriods) 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) + case "ignoreDataBefore": + err = unpopulateTime[datetime.RFC3339](val, "IgnoreDataBefore", &d.IgnoreDataBefore) 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) + case "metricName": + err = unpopulate(val, "MetricName", &d.MetricName) delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &d.MetricNamespace) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DynamicPromQLCriteria. +func (d DynamicPromQLCriteria) 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) + populate(objectMap, "alertSensitivity", d.AlertSensitivity) + objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion + populateTime[datetime.RFC3339](objectMap, "ignoreDataBefore", d.IgnoreDataBefore) + populate(objectMap, "name", d.Name) + populate(objectMap, "operator", d.Operator) + populate(objectMap, "query", d.Query) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicPromQLCriteria. +func (d *DynamicPromQLCriteria) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) + case "criterionType": + err = unpopulate(val, "CriterionType", &d.CriterionType) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "ignoreDataBefore": + err = unpopulateTime[datetime.RFC3339](val, "IgnoreDataBefore", &d.IgnoreDataBefore) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &d.Query) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DynamicThresholdFailingPeriods. +func (d DynamicThresholdFailingPeriods) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populate(objectMap, "minFailingPeriodsToAlert", d.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", d.NumberOfEvaluationPeriods) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// 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", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &d.MinFailingPeriodsToAlert) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "numberOfEvaluationPeriods": + err = unpopulate(val, "NumberOfEvaluationPeriods", &d.NumberOfEvaluationPeriods) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. -func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailNotification. +func (e EmailNotification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + 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 ErrorResponseAdditionalInfo. -func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { +// 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) @@ -4388,11 +3191,14 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "customEmails": + err = unpopulate(val, "CustomEmails", &e.CustomEmails) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + 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 { @@ -4402,16 +3208,18 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. -func (e ErrorResponseAutoGenerated) 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, "code", e.Code) - populate(objectMap, "message", e.Message) + 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 ErrorResponseAutoGenerated. -func (e *ErrorResponseAutoGenerated) 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", e, err) @@ -4419,11 +3227,17 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + 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 { @@ -4433,15 +3247,15 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. -func (e ErrorResponseAutoGenerated2) 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, "error", e.Error) + populate(objectMap, "receiverName", e.ReceiverName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. -func (e *ErrorResponseAutoGenerated2) 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", e, err) @@ -4449,8 +3263,8 @@ func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "receiverName": + err = unpopulate(val, "ReceiverName", &e.ReceiverName) delete(rawMsg, key) } if err != nil { @@ -4460,15 +3274,16 @@ func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. -func (e ErrorResponseCommonV2) 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, "error", e.Error) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. -func (e *ErrorResponseCommonV2) 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", e, err) @@ -4476,8 +3291,11 @@ func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + 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 { @@ -4487,8 +3305,8 @@ func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. -func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { +// 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) @@ -4498,8 +3316,8 @@ func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseDetails. -func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { +// 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) @@ -4530,9 +3348,61 @@ func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EtwProviderDataSource. +func (e EtwProviderDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventIds", e.EventIDs) + populate(objectMap, "keyword", e.Keyword) + populate(objectMap, "logLevel", e.LogLevel) + populate(objectMap, "name", e.Name) + populate(objectMap, "provider", e.Provider) + populate(objectMap, "providerType", e.ProviderType) + populate(objectMap, "streams", e.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EtwProviderDataSource. +func (e *EtwProviderDataSource) UnmarshalJSON(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 "eventIds": + err = unpopulate(val, "EventIDs", &e.EventIDs) + delete(rawMsg, key) + case "keyword": + err = unpopulate(val, "Keyword", &e.Keyword) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &e.LogLevel) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &e.Provider) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &e.ProviderType) + 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 EventCategoryCollection. func (e EventCategoryCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } @@ -4546,6 +3416,9 @@ func (e *EventCategoryCollection) UnmarshalJSON(data []byte) error { 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) @@ -4568,7 +3441,7 @@ func (e EventData) MarshalJSON() ([]byte, error) { populate(objectMap, "description", e.Description) populate(objectMap, "eventDataId", e.EventDataID) populate(objectMap, "eventName", e.EventName) - populateDateTimeRFC3339(objectMap, "eventTimestamp", e.EventTimestamp) + populateTime[datetime.RFC3339](objectMap, "eventTimestamp", e.EventTimestamp) populate(objectMap, "httpRequest", e.HTTPRequest) populate(objectMap, "id", e.ID) populate(objectMap, "level", e.Level) @@ -4581,7 +3454,7 @@ func (e EventData) MarshalJSON() ([]byte, error) { populate(objectMap, "resourceType", e.ResourceType) populate(objectMap, "status", e.Status) populate(objectMap, "subStatus", e.SubStatus) - populateDateTimeRFC3339(objectMap, "submissionTimestamp", e.SubmissionTimestamp) + populateTime[datetime.RFC3339](objectMap, "submissionTimestamp", e.SubmissionTimestamp) populate(objectMap, "subscriptionId", e.SubscriptionID) populate(objectMap, "tenantId", e.TenantID) return json.Marshal(objectMap) @@ -4621,7 +3494,7 @@ func (e *EventData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "EventName", &e.EventName) delete(rawMsg, key) case "eventTimestamp": - err = unpopulateDateTimeRFC3339(val, "EventTimestamp", &e.EventTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "EventTimestamp", &e.EventTimestamp) delete(rawMsg, key) case "httpRequest": err = unpopulate(val, "HTTPRequest", &e.HTTPRequest) @@ -4660,7 +3533,7 @@ func (e *EventData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "SubStatus", &e.SubStatus) delete(rawMsg, key) case "submissionTimestamp": - err = unpopulateDateTimeRFC3339(val, "SubmissionTimestamp", &e.SubmissionTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "SubmissionTimestamp", &e.SubmissionTimestamp) delete(rawMsg, key) case "subscriptionId": err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) @@ -4707,41 +3580,6 @@ func (e *EventDataCollection) UnmarshalJSON(data []byte) error { 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) @@ -4809,6 +3647,7 @@ func (e EventHubReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) 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) @@ -4831,6 +3670,9 @@ func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { case "eventHubNameSpace": err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &e.ManagedIdentity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) @@ -4858,68 +3700,37 @@ func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { 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) + populate(objectMap, "streams", e.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverConfigurationSpec. -func (f *FailoverConfigurationSpec) UnmarshalJSON(data []byte) error { +// 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", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "activeLocation": - err = unpopulate(val, "ActiveLocation", &f.ActiveLocation) + case "extensionName": + err = unpopulate(val, "ExtensionName", &e.ExtensionName) delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &f.Locations) + 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", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil @@ -5009,6 +3820,7 @@ func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "logDirectories", i.LogDirectories) populate(objectMap, "name", i.Name) populate(objectMap, "streams", i.Streams) + populate(objectMap, "transformKql", i.TransformKql) return json.Marshal(objectMap) } @@ -5030,6 +3842,9 @@ func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &i.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &i.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -5041,10 +3856,10 @@ func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { // 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) + populateTime[datetime.RFC3339](objectMap, "activatedTime", i.ActivatedTime) populate(objectMap, "isActive", i.IsActive) populate(objectMap, "name", i.Name) - populateDateTimeRFC3339(objectMap, "resolvedTime", i.ResolvedTime) + populateTime[datetime.RFC3339](objectMap, "resolvedTime", i.ResolvedTime) populate(objectMap, "ruleName", i.RuleName) return json.Marshal(objectMap) } @@ -5059,7 +3874,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { var err error switch key { case "activatedTime": - err = unpopulateDateTimeRFC3339(val, "ActivatedTime", &i.ActivatedTime) + err = unpopulateTime[datetime.RFC3339](val, "ActivatedTime", &i.ActivatedTime) delete(rawMsg, key) case "isActive": err = unpopulate(val, "IsActive", &i.IsActive) @@ -5068,7 +3883,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) case "resolvedTime": - err = unpopulateDateTimeRFC3339(val, "ResolvedTime", &i.ResolvedTime) + err = unpopulateTime[datetime.RFC3339](val, "ResolvedTime", &i.ResolvedTime) delete(rawMsg, key) case "ruleName": err = unpopulate(val, "RuleName", &i.RuleName) @@ -5084,6 +3899,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IncidentListResult. func (i IncidentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } @@ -5097,6 +3913,9 @@ func (i *IncidentListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) @@ -5108,16 +3927,86 @@ func (i *IncidentListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. -func (i IngestionSettings) 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, "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 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connection": + err = unpopulate(val, "Connection", &i.Connection) + delete(rawMsg, key) + case "incidentManagementService": + err = unpopulate(val, "IncidentManagementService", &i.IncidentManagementService) + delete(rawMsg, key) + case "mappings": + err = unpopulate(val, "Mappings", &i.Mappings) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + 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 IncidentServiceConnection. +func (i IncidentServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + return json.Marshal(objectMap) +} + +// 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + 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 IngestionQuotasLogs. +func (i IngestionQuotasLogs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) + populate(objectMap, "maxRequestsPerMinute", i.MaxRequestsPerMinute) + populate(objectMap, "maxSizePerMinuteInGB", i.MaxSizePerMinuteInGB) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. -func (i *IngestionSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionQuotasLogs. +func (i *IngestionQuotasLogs) UnmarshalJSON(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) @@ -5125,11 +4014,11 @@ func (i *IngestionSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) + case "maxRequestsPerMinute": + err = unpopulate(val, "MaxRequestsPerMinute", &i.MaxRequestsPerMinute) delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) + case "maxSizePerMinuteInGB": + err = unpopulate(val, "MaxSizePerMinuteInGB", &i.MaxSizePerMinuteInGB) delete(rawMsg, key) } if err != nil { @@ -5244,45 +4133,6 @@ func (l *LocationSpec) UnmarshalJSON(data []byte) error { 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) @@ -5318,33 +4168,6 @@ func (l *LogAnalyticsDestination) UnmarshalJSON(data []byte) error { 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) @@ -5372,33 +4195,6 @@ func (l *LogFileSettingsText) UnmarshalJSON(data []byte) error { 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) @@ -5407,6 +4203,7 @@ func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "name", l.Name) populate(objectMap, "settings", l.Settings) populate(objectMap, "streams", l.Streams) + populate(objectMap, "transformKql", l.TransformKql) return json.Marshal(objectMap) } @@ -5434,6 +4231,9 @@ func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &l.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &l.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) @@ -5472,6 +4272,7 @@ func (l *LogFilesDataSourceSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogProfileCollection. func (l LogProfileCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } @@ -5485,6 +4286,9 @@ func (l *LogProfileCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) @@ -5546,6 +4350,7 @@ func (l LogProfileResource) MarshalJSON() ([]byte, error) { populate(objectMap, "location", l.Location) populate(objectMap, "name", l.Name) populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) populate(objectMap, "tags", l.Tags) populate(objectMap, "type", l.Type) return json.Marshal(objectMap) @@ -5572,6 +4377,9 @@ func (l *LogProfileResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) @@ -5621,7 +4429,6 @@ func (l *LogProfileResourcePatch) UnmarshalJSON(data []byte) error { 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) @@ -5639,9 +4446,6 @@ func (l *LogSettings) UnmarshalJSON(data []byte) error { 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) @@ -5660,6 +4464,7 @@ func (l *LogSettings) UnmarshalJSON(data []byte) error { func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) 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) @@ -5678,6 +4483,9 @@ func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { case "callbackUrl": err = unpopulate(val, "CallbackURL", &l.CallbackURL) delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &l.ManagedIdentity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) @@ -5695,33 +4503,6 @@ func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { 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) @@ -5751,108 +4532,7 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { 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) + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { @@ -5982,7 +4662,7 @@ func (m *MetricAlertAction) UnmarshalJSON(data []byte) error { // 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 + populate(objectMap, "odata.type", m.ODataType) if m.AdditionalProperties != nil { for key, val := range m.AdditionalProperties { objectMap[key] = val @@ -6070,14 +4750,17 @@ func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data [ // MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionProperties", m.ActionProperties) populate(objectMap, "actions", m.Actions) populate(objectMap, "autoMitigate", m.AutoMitigate) populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "customProperties", m.CustomProperties) 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) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTime", m.LastUpdatedTime) + populate(objectMap, "resolveConfiguration", m.ResolveConfiguration) populate(objectMap, "scopes", m.Scopes) populate(objectMap, "severity", m.Severity) populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) @@ -6095,6 +4778,9 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionProperties": + err = unpopulate(val, "ActionProperties", &m.ActionProperties) + delete(rawMsg, key) case "actions": err = unpopulate(val, "Actions", &m.Actions) delete(rawMsg, key) @@ -6104,6 +4790,9 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { case "criteria": m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) delete(rawMsg, key) + case "customProperties": + err = unpopulate(val, "CustomProperties", &m.CustomProperties) + delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &m.Description) delete(rawMsg, key) @@ -6117,7 +4806,10 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "IsMigrated", &m.IsMigrated) delete(rawMsg, key) case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTime", &m.LastUpdatedTime) + delete(rawMsg, key) + case "resolveConfiguration": + err = unpopulate(val, "ResolveConfiguration", &m.ResolveConfiguration) delete(rawMsg, key) case "scopes": err = unpopulate(val, "Scopes", &m.Scopes) @@ -6145,14 +4837,17 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionProperties", m.ActionProperties) populate(objectMap, "actions", m.Actions) populate(objectMap, "autoMitigate", m.AutoMitigate) populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "customProperties", m.CustomProperties) 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) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTime", m.LastUpdatedTime) + populate(objectMap, "resolveConfiguration", m.ResolveConfiguration) populate(objectMap, "scopes", m.Scopes) populate(objectMap, "severity", m.Severity) populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) @@ -6170,6 +4865,9 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionProperties": + err = unpopulate(val, "ActionProperties", &m.ActionProperties) + delete(rawMsg, key) case "actions": err = unpopulate(val, "Actions", &m.Actions) delete(rawMsg, key) @@ -6179,6 +4877,9 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { case "criteria": m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) delete(rawMsg, key) + case "customProperties": + err = unpopulate(val, "CustomProperties", &m.CustomProperties) + delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &m.Description) delete(rawMsg, key) @@ -6192,7 +4893,10 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { err = unpopulate(val, "IsMigrated", &m.IsMigrated) delete(rawMsg, key) case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTime", &m.LastUpdatedTime) + delete(rawMsg, key) + case "resolveConfiguration": + err = unpopulate(val, "ResolveConfiguration", &m.ResolveConfiguration) delete(rawMsg, key) case "scopes": err = unpopulate(val, "Scopes", &m.Scopes) @@ -6221,9 +4925,11 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { func (m MetricAlertResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) @@ -6241,6 +4947,9 @@ func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -6250,6 +4959,9 @@ func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) @@ -6267,6 +4979,7 @@ func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertResourceCollection. func (m MetricAlertResourceCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -6280,6 +4993,9 @@ func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -6294,6 +5010,7 @@ func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", m.Identity) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) @@ -6308,6 +5025,9 @@ func (m *MetricAlertResourcePatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) @@ -6439,7 +5159,7 @@ 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) + populateTime[datetime.RFC3339](objectMap, "timestamp", m.Timestamp) return json.Marshal(objectMap) } @@ -6459,7 +5179,7 @@ func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &m.Timestamp) + err = unpopulateTime[datetime.RFC3339](val, "Timestamp", &m.Timestamp) delete(rawMsg, key) } if err != nil { @@ -6542,6 +5262,7 @@ func (m *MetricBaselinesProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricBaselinesResponse. func (m MetricBaselinesResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -6555,6 +5276,9 @@ func (m *MetricBaselinesResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -6718,6 +5442,7 @@ func (m *MetricDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection. func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -6731,6 +5456,9 @@ func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -6823,6 +5551,7 @@ func (m *MetricNamespace) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection. func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -6836,6 +5565,9 @@ func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -6877,7 +5609,6 @@ func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error { // 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) @@ -6893,9 +5624,6 @@ func (m *MetricSettings) UnmarshalJSON(data []byte) error { 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) @@ -7022,7 +5750,7 @@ func (m MetricValue) MarshalJSON() ([]byte, error) { populate(objectMap, "count", m.Count) populate(objectMap, "maximum", m.Maximum) populate(objectMap, "minimum", m.Minimum) - populateDateTimeRFC3339(objectMap, "timeStamp", m.TimeStamp) + populateTime[datetime.RFC3339](objectMap, "timeStamp", m.TimeStamp) populate(objectMap, "total", m.Total) return json.Marshal(objectMap) } @@ -7049,7 +5777,7 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Minimum", &m.Minimum) delete(rawMsg, key) case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) + err = unpopulateTime[datetime.RFC3339](val, "TimeStamp", &m.TimeStamp) delete(rawMsg, key) case "total": err = unpopulate(val, "Total", &m.Total) @@ -7062,16 +5790,19 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Metrics. -func (m Metrics) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MicrosoftFabricDestination. +func (m MicrosoftFabricDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "internalId", m.InternalID) - populate(objectMap, "prometheusQueryEndpoint", m.PrometheusQueryEndpoint) + populate(objectMap, "artifactId", m.ArtifactID) + populate(objectMap, "databaseName", m.DatabaseName) + populate(objectMap, "ingestionUri", m.IngestionURI) + populate(objectMap, "name", m.Name) + populate(objectMap, "tenantId", m.TenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Metrics. -func (m *Metrics) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftFabricDestination. +func (m *MicrosoftFabricDestination) UnmarshalJSON(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) @@ -7079,38 +5810,20 @@ func (m *Metrics) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "internalId": - err = unpopulate(val, "InternalID", &m.InternalID) + case "artifactId": + err = unpopulate(val, "ArtifactID", &m.ArtifactID) delete(rawMsg, key) - case "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &m.PrometheusQueryEndpoint) + case "databaseName": + err = unpopulate(val, "DatabaseName", &m.DatabaseName) 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) + case "ingestionUri": + err = unpopulate(val, "IngestionURI", &m.IngestionURI) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) delete(rawMsg, key) } if err != nil { @@ -7158,7 +5871,7 @@ func (m *MonitoringAccountDestination) UnmarshalJSON(data []byte) error { // 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, "criterionType", m.CriterionType) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "metricName", m.MetricName) populate(objectMap, "metricNamespace", m.MetricNamespace) @@ -7221,53 +5934,52 @@ func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MultiPromQLCriteria. +func (m MultiPromQLCriteria) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) + populate(objectMap, "criterionType", m.CriterionType) + populate(objectMap, "name", m.Name) + populate(objectMap, "query", m.Query) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. -func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MultiPromQLCriteria. +func (m *MultiPromQLCriteria) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) + case "criterionType": + err = unpopulate(val, "CriterionType", &m.CriterionType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &m.Query) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. -func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeter. +func (n NetworkSecurityPerimeter) 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) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. -func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeter. +func (n *NetworkSecurityPerimeter) UnmarshalJSON(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) @@ -7275,41 +5987,14 @@ func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { 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) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) + case "location": + err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) delete(rawMsg, key) } if err != nil { @@ -7319,211 +6004,236 @@ func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "id": + err = unpopulate(val, "ID", &n.ID) 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) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "type": + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n NetworkSecurityPerimeterConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n *NetworkSecurityPerimeterConfigurationListResult) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", n, 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) + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. -func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n NetworkSecurityPerimeterConfigurationProperties) 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) + populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "profile", n.Profile) + populate(objectMap, "provisioningIssues", n.ProvisioningIssues) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "resourceAssociation", n.ResourceAssociation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. -func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "networkSecurityPerimeter": + err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "profile": + err = unpopulate(val, "Profile", &n.Profile) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "resourceAssociation": + err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityProfile. +func (n NetworkSecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "accessRules", n.AccessRules) + populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) + populate(objectMap, "diagnosticSettingsVersion", n.DiagnosticSettingsVersion) + populate(objectMap, "enabledLogCategories", n.EnabledLogCategories) + populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityProfile. +func (n *NetworkSecurityProfile) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "accessRules": + err = unpopulate(val, "AccessRules", &n.AccessRules) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "accessRulesVersion": + err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) + delete(rawMsg, key) + case "diagnosticSettingsVersion": + err = unpopulate(val, "DiagnosticSettingsVersion", &n.DiagnosticSettingsVersion) + delete(rawMsg, key) + case "enabledLogCategories": + err = unpopulate(val, "EnabledLogCategories", &n.EnabledLogCategories) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResultAutoGenerated. -func (o OperationListResultAutoGenerated) 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, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + 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 OperationListResultAutoGenerated. -func (o *OperationListResultAutoGenerated) 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", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "alertType": + err = unpopulate(val, "AlertType", &n.AlertType) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + 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 "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &n.IncidentReceivers) + 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", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil @@ -7532,11 +6242,11 @@ func (o *OperationListResultAutoGenerated) UnmarshalJSON(data []byte) error { // 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) + populateTime[datetime.RFC3339](objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populateTime[datetime.RFC3339](objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -7551,7 +6261,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -7563,7 +6273,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -7576,321 +6286,374 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. -func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelLogsDataSource. +func (o OtelLogsDataSource) 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) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "replaceResourceIdWithReference", o.ReplaceResourceIDWithReference) + populate(objectMap, "resourceAttributeRouting", o.ResourceAttributeRouting) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PerfCounterDataSource. -func (p *PerfCounterDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelLogsDataSource. +func (o *OtelLogsDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "counterSpecifiers": - err = unpopulate(val, "CounterSpecifiers", &p.CounterSpecifiers) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) + delete(rawMsg, key) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "samplingFrequencyInSeconds": - err = unpopulate(val, "SamplingFrequencyInSeconds", &p.SamplingFrequencyInSeconds) + case "replaceResourceIdWithReference": + err = unpopulate(val, "ReplaceResourceIDWithReference", &o.ReplaceResourceIDWithReference) + delete(rawMsg, key) + case "resourceAttributeRouting": + err = unpopulate(val, "ResourceAttributeRouting", &o.ResourceAttributeRouting) delete(rawMsg, key) case "streams": - err = unpopulate(val, "Streams", &p.Streams) + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PlatformTelemetryDataSource. -func (p PlatformTelemetryDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelLogsDataSourceResourceAttributeRouting. +func (o OtelLogsDataSourceResourceAttributeRouting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) + populate(objectMap, "attributeName", o.AttributeName) + populate(objectMap, "attributeValue", o.AttributeValue) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformTelemetryDataSource. -func (p *PlatformTelemetryDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelLogsDataSourceResourceAttributeRouting. +func (o *OtelLogsDataSourceResourceAttributeRouting) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) + case "attributeName": + err = unpopulate(val, "AttributeName", &o.AttributeName) delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) + case "attributeValue": + err = unpopulate(val, "AttributeValue", &o.AttributeValue) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. -func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelLogsDirectDataSource. +func (o OtelLogsDirectDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) - populate(objectMap, "scaleMode", p.ScaleMode) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "replaceResourceIdWithReference", o.ReplaceResourceIDWithReference) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveAutoscalePolicy. -func (p *PredictiveAutoscalePolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelLogsDirectDataSource. +func (o *OtelLogsDirectDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "scaleLookAheadTime": - err = unpopulate(val, "ScaleLookAheadTime", &p.ScaleLookAheadTime) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) delete(rawMsg, key) - case "scaleMode": - err = unpopulate(val, "ScaleMode", &p.ScaleMode) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "replaceResourceIdWithReference": + err = unpopulate(val, "ReplaceResourceIDWithReference", &o.ReplaceResourceIDWithReference) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. -func (p PredictiveResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelMetricsDataSource. +func (o OtelMetricsDataSource) 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) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "resourceAttributeRouting", o.ResourceAttributeRouting) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveResponse. -func (p *PredictiveResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelMetricsDataSource. +func (o *OtelMetricsDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "data": - err = unpopulate(val, "Data", &p.Data) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &p.Interval) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &p.MetricName) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) + case "resourceAttributeRouting": + err = unpopulate(val, "ResourceAttributeRouting", &o.ResourceAttributeRouting) delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &p.Timespan) + case "streams": + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PredictiveValue. -func (p PredictiveValue) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelMetricsDataSourceResourceAttributeRouting. +func (o OtelMetricsDataSourceResourceAttributeRouting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "timeStamp", p.TimeStamp) - populate(objectMap, "value", p.Value) + populate(objectMap, "attributeName", o.AttributeName) + populate(objectMap, "attributeValue", o.AttributeValue) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveValue. -func (p *PredictiveValue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelMetricsDataSourceResourceAttributeRouting. +func (o *OtelMetricsDataSourceResourceAttributeRouting) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &p.TimeStamp) + case "attributeName": + err = unpopulate(val, "AttributeName", &o.AttributeName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "attributeValue": + err = unpopulate(val, "AttributeValue", &o.AttributeValue) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelMetricsDirectDataSource. +func (o OtelMetricsDirectDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelMetricsDirectDataSource. +func (o *OtelMetricsDirectDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) + delete(rawMsg, key) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelTracesDataSource. +func (o OtelTracesDataSource) 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) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "replaceResourceIdWithReference", o.ReplaceResourceIDWithReference) + populate(objectMap, "resourceAttributeRouting", o.ResourceAttributeRouting) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelTracesDataSource. +func (o *OtelTracesDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) + delete(rawMsg, key) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "replaceResourceIdWithReference": + err = unpopulate(val, "ReplaceResourceIDWithReference", &o.ReplaceResourceIDWithReference) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "resourceAttributeRouting": + err = unpopulate(val, "ResourceAttributeRouting", &o.ResourceAttributeRouting) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelTracesDataSourceResourceAttributeRouting. +func (o OtelTracesDataSourceResourceAttributeRouting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) + populate(objectMap, "attributeName", o.AttributeName) + populate(objectMap, "attributeValue", o.AttributeValue) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelTracesDataSourceResourceAttributeRouting. +func (o *OtelTracesDataSourceResourceAttributeRouting) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) + case "attributeName": + err = unpopulate(val, "AttributeName", &o.AttributeName) + delete(rawMsg, key) + case "attributeValue": + err = unpopulate(val, "AttributeValue", &o.AttributeValue) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OtelTracesDirectDataSource. +func (o OtelTracesDirectDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "enrichWithReference", o.EnrichWithReference) + populate(objectMap, "enrichWithResourceAttributes", o.EnrichWithResourceAttributes) + populate(objectMap, "name", o.Name) + populate(objectMap, "replaceResourceIdWithReference", o.ReplaceResourceIDWithReference) + populate(objectMap, "streams", o.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OtelTracesDirectDataSource. +func (o *OtelTracesDirectDataSource) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "enrichWithReference": + err = unpopulate(val, "EnrichWithReference", &o.EnrichWithReference) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "enrichWithResourceAttributes": + err = unpopulate(val, "EnrichWithResourceAttributes", &o.EnrichWithResourceAttributes) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "replaceResourceIdWithReference": + err = unpopulate(val, "ReplaceResourceIDWithReference", &o.ReplaceResourceIDWithReference) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &o.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. +func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) + populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) + populate(objectMap, "streams", p.Streams) + populate(objectMap, "transformKql", p.TransformKql) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// 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) @@ -7898,17 +6661,20 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "counterSpecifiers": + err = unpopulate(val, "CounterSpecifiers", &p.CounterSpecifiers) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "samplingFrequencyInSeconds": + err = unpopulate(val, "SamplingFrequencyInSeconds", &p.SamplingFrequencyInSeconds) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "streams": + err = unpopulate(val, "Streams", &p.Streams) + delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &p.TransformKql) delete(rawMsg, key) } if err != nil { @@ -7918,15 +6684,18 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PerformanceCountersOTelDataSource. +func (p PerformanceCountersOTelDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) + 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 PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceCountersOTelDataSource. +func (p *PerformanceCountersOTelDataSource) UnmarshalJSON(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) @@ -7934,8 +6703,17 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) + 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 { @@ -7945,17 +6723,16 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlatformTelemetryDataSource. +func (p PlatformTelemetryDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "name", p.Name) + populate(objectMap, "streams", p.Streams) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -7963,14 +6740,11 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { 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) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "streams": + err = unpopulate(val, "Streams", &p.Streams) delete(rawMsg, key) } if err != nil { @@ -7980,16 +6754,16 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. -func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. +func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceId", p.ResourceID) - populate(objectMap, "scopeId", p.ScopeID) + populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) + populate(objectMap, "scaleMode", p.ScaleMode) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopedResource. -func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { +// 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) @@ -7997,11 +6771,11 @@ func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) + case "scaleLookAheadTime": + err = unpopulate(val, "ScaleLookAheadTime", &p.ScaleLookAheadTime) delete(rawMsg, key) - case "scopeId": - err = unpopulate(val, "ScopeID", &p.ScopeID) + case "scaleMode": + err = unpopulate(val, "ScaleMode", &p.ScaleMode) delete(rawMsg, key) } if err != nil { @@ -8011,17 +6785,19 @@ func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. +func (p PredictiveResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + 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 PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { +// 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) @@ -8029,14 +6805,20 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "data": + err = unpopulate(val, "Data", &p.Data) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) + case "interval": + err = unpopulate(val, "Interval", &p.Interval) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + 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 { @@ -8046,17 +6828,16 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrometheusForwarderDataSource. -func (p PrometheusForwarderDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PredictiveValue. +func (p PredictiveValue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "labelIncludeFilter", p.LabelIncludeFilter) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) + populateTime[datetime.RFC3339](objectMap, "timeStamp", p.TimeStamp) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusForwarderDataSource. -func (p *PrometheusForwarderDataSource) UnmarshalJSON(data []byte) error { +// 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) @@ -8064,14 +6845,11 @@ func (p *PrometheusForwarderDataSource) UnmarshalJSON(data []byte) error { 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) + case "timeStamp": + err = unpopulateTime[datetime.RFC3339](val, "TimeStamp", &p.TimeStamp) delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -8081,17 +6859,15 @@ func (p *PrometheusForwarderDataSource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// 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) - 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 { +// 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) @@ -8102,12 +6878,6 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { 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) @@ -8116,17 +6886,19 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResourceAutoGenerated. -func (p ProxyResourceAutoGenerated) MarshalJSON() ([]byte, error) { +// 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, "systemData", p.SystemData) 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 { +// 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) @@ -8140,6 +6912,12 @@ func (p *ProxyResourceAutoGenerated) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -8151,452 +6929,443 @@ func (p *ProxyResourceAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Recurrence. -func (r Recurrence) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "frequency", r.Frequency) - populate(objectMap, "schedule", r.Schedule) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence. -func (r *Recurrence) UnmarshalJSON(data []byte) error { +// 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, 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) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. -func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) 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) + 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 RecurrentSchedule. -func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { +// 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, 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) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) - case "minutes": - err = unpopulate(val, "Minutes", &r.Minutes) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &r.TimeZone) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) 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) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// 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", r, err) + 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", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &r.Type) + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. -func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) 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) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. -func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { +// 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", r, err) + 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", &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) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. -func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) 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) + 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 ResourceAutoGenerated2. -func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { +// 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", r, err) + 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", &r.ID) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + } + 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 "type": - err = unpopulate(val, "Type", &r.Type) + case "scopeId": + err = unpopulate(val, "ScopeID", &p.ScopeID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. -func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + 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 ResourceAutoGenerated3. -func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { +// 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", r, err) + 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", &r.ID) + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "status": + err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. -func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PromQLCriteria. +func (p PromQLCriteria) 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) + populate(objectMap, "allOf", p.AllOf) + populate(objectMap, "failingPeriods", p.FailingPeriods) + objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorPromQLCriteria + if p.AdditionalProperties != nil { + for key, val := range p.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. -func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PromQLCriteria. +func (p *PromQLCriteria) UnmarshalJSON(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) + 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", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "allOf": + p.AllOf, err = unmarshalMultiPromQLCriteriaClassificationArray(val) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &p.FailingPeriods) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "odata.type": + err = unpopulate(val, "ODataType", &p.ODataType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + default: + if p.AdditionalProperties == nil { + p.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + p.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. -func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrometheusForwarderDataSource. +func (p PrometheusForwarderDataSource) 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) + populate(objectMap, "customVMScrapeConfig", p.CustomVMScrapeConfig) + 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 ResourceAutoGenerated5. -func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { +// 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", r, err) + 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", &r.ID) + case "customVMScrapeConfig": + err = unpopulate(val, "CustomVMScrapeConfig", &p.CustomVMScrapeConfig) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "labelIncludeFilter": + err = unpopulate(val, "LabelIncludeFilter", &p.LabelIncludeFilter) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "streams": + err = unpopulate(val, "Streams", &p.Streams) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. -func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssue. +func (p ProvisioningIssue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdate. -func (r *ResourceForUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssue. +func (p *ProvisioningIssue) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &r.Identity) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdateIdentity. -func (r ResourceForUpdateIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssueProperties. +func (p ProvisioningIssueProperties) 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) + populate(objectMap, "description", p.Description) + populate(objectMap, "issueType", p.IssueType) + populate(objectMap, "severity", p.Severity) + populate(objectMap, "suggestedAccessRules", p.SuggestedAccessRules) + populate(objectMap, "suggestedResourceIds", p.SuggestedResourceIDs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdateIdentity. -func (r *ResourceForUpdateIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssueProperties. +func (p *ProvisioningIssueProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) + case "issueType": + err = unpopulate(val, "IssueType", &p.IssueType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "severity": + err = unpopulate(val, "Severity", &p.Severity) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) + case "suggestedAccessRules": + err = unpopulate(val, "SuggestedAccessRules", &p.SuggestedAccessRules) + delete(rawMsg, key) + case "suggestedResourceIds": + err = unpopulate(val, "SuggestedResourceIDs", &p.SuggestedResourceIDs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Response. -func (r Response) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryFailingPeriods. +func (q QueryFailingPeriods) 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) + populate(objectMap, "for", q.For) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Response. -func (r *Response) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryFailingPeriods. +func (q *QueryFailingPeriods) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", q, 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) + case "for": + err = unpopulate(val, "For", &q.For) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResponseWithError. -func (r ResponseWithError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Recurrence. +func (r Recurrence) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", r.Error) + populate(objectMap, "frequency", r.Frequency) + populate(objectMap, "schedule", r.Schedule) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseWithError. -func (r *ResponseWithError) UnmarshalJSON(data []byte) error { +// 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) @@ -8604,8 +7373,11 @@ func (r *ResponseWithError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &r.Error) + 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 { @@ -8615,16 +7387,18 @@ func (r *ResponseWithError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { +// 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, "enabled", r.Enabled) + 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 RetentionPolicy. -func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { +// 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) @@ -8635,8 +7409,14 @@ func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { case "days": err = unpopulate(val, "Days", &r.Days) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &r.Enabled) + 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 { @@ -8646,15 +7426,15 @@ func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleAction. -func (r RuleAction) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReferencesSpecEnrichmentData. +func (r ReferencesSpecEnrichmentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["odata.type"] = r.ODataType + populate(objectMap, "storageBlobs", r.StorageBlobs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleAction. -func (r *RuleAction) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferencesSpecEnrichmentData. +func (r *ReferencesSpecEnrichmentData) UnmarshalJSON(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) @@ -8662,8 +7442,8 @@ func (r *RuleAction) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) + case "storageBlobs": + err = unpopulate(val, "StorageBlobs", &r.StorageBlobs) delete(rawMsg, key) } if err != nil { @@ -8673,16 +7453,16 @@ func (r *RuleAction) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleCondition. -func (r RuleCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResolveConfiguration. +func (r ResolveConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataSource", r.DataSource) - objectMap["odata.type"] = r.ODataType + populate(objectMap, "autoResolved", r.AutoResolved) + populate(objectMap, "timeToResolve", r.TimeToResolve) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCondition. -func (r *RuleCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResolveConfiguration. +func (r *ResolveConfiguration) UnmarshalJSON(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) @@ -8690,11 +7470,11 @@ func (r *RuleCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dataSource": - r.DataSource, err = unmarshalRuleDataSourceClassification(val) + case "autoResolved": + err = unpopulate(val, "AutoResolved", &r.AutoResolved) delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) + case "timeToResolve": + err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) delete(rawMsg, key) } if err != nil { @@ -8704,19 +7484,16 @@ func (r *RuleCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleDataSource. -func (r RuleDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceAssociation. +func (r ResourceAssociation) 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) + populate(objectMap, "accessMode", r.AccessMode) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleDataSource. -func (r *RuleDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAssociation. +func (r *ResourceAssociation) UnmarshalJSON(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) @@ -8724,20 +7501,11 @@ func (r *RuleDataSource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) + case "accessMode": + err = unpopulate(val, "AccessMode", &r.AccessMode) 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) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { @@ -8747,17 +7515,16 @@ func (r *RuleDataSource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. -func (r RuleEmailAction) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. +func (r ResourceForUpdate) 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) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEmailAction. -func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { +// 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) @@ -8765,14 +7532,11 @@ func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { 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) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) delete(rawMsg, key) - case "sendToServiceOwners": - err = unpopulate(val, "SendToServiceOwners", &r.SendToServiceOwners) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { @@ -8782,15 +7546,18 @@ func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventClaimsDataSource. -func (r RuleManagementEventClaimsDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdateIdentity. +func (r ResourceForUpdateIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emailAddress", r.EmailAddress) + 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 RuleManagementEventClaimsDataSource. -func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { +// 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) @@ -8798,8 +7565,17 @@ func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &r.EmailAddress) + 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 { @@ -8809,28 +7585,20 @@ func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. -func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Response. +func (r Response) 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) + 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 RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { +// 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) @@ -8838,47 +7606,23 @@ func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { 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) + case "cost": + err = unpopulate(val, "Cost", &r.Cost) delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) + case "interval": + err = unpopulate(val, "Interval", &r.Interval) delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &r.ResourceProviderName) + case "namespace": + err = unpopulate(val, "Namespace", &r.Namespace) delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) + case "resourceregion": + err = unpopulate(val, "Resourceregion", &r.Resourceregion) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "timespan": + err = unpopulate(val, "Timespan", &r.Timespan) delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &r.SubStatus) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -8888,20 +7632,16 @@ func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. -func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. +func (r RetentionPolicy) 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) + populate(objectMap, "days", r.Days) + populate(objectMap, "enabled", r.Enabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { +// 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) @@ -8909,23 +7649,11 @@ func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { 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) + case "days": + err = unpopulate(val, "Days", &r.Days) delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) delete(rawMsg, key) } if err != nil { @@ -8966,41 +7694,6 @@ func (r *RuleResolveConfiguration) UnmarshalJSON(data []byte) error { 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) @@ -9184,8 +7877,7 @@ func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { 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, "resolveConfiguration", s.ResolveConfiguration) populate(objectMap, "scopes", s.Scopes) populate(objectMap, "severity", s.Severity) populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) @@ -9242,11 +7934,8 @@ func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { 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) + case "resolveConfiguration": + err = unpopulate(val, "ResolveConfiguration", &s.ResolveConfiguration) delete(rawMsg, key) case "scopes": err = unpopulate(val, "Scopes", &s.Scopes) @@ -9477,8 +8166,10 @@ func (s *ScopedResourceListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScopedResourceProperties. func (s ScopedResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "kind", s.Kind) populate(objectMap, "linkedResourceId", s.LinkedResourceID) populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "subscriptionLocation", s.SubscriptionLocation) return json.Marshal(objectMap) } @@ -9491,12 +8182,18 @@ func (s *ScopedResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) case "linkedResourceId": err = unpopulate(val, "LinkedResourceID", &s.LinkedResourceID) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) + case "subscriptionLocation": + err = unpopulate(val, "SubscriptionLocation", &s.SubscriptionLocation) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -9540,6 +8237,135 @@ func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServiceDiagnosticSettings. +func (s ServiceDiagnosticSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventHubAuthorizationRuleId", s.EventHubAuthorizationRuleID) + populate(objectMap, "logs", s.Logs) + populate(objectMap, "metrics", s.Metrics) + populate(objectMap, "serviceBusRuleId", s.ServiceBusRuleID) + populate(objectMap, "storageAccountId", s.StorageAccountID) + populate(objectMap, "workspaceId", s.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceDiagnosticSettings. +func (s *ServiceDiagnosticSettings) UnmarshalJSON(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 "eventHubAuthorizationRuleId": + err = unpopulate(val, "EventHubAuthorizationRuleID", &s.EventHubAuthorizationRuleID) + delete(rawMsg, key) + case "logs": + err = unpopulate(val, "Logs", &s.Logs) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &s.Metrics) + delete(rawMsg, key) + case "serviceBusRuleId": + err = unpopulate(val, "ServiceBusRuleID", &s.ServiceBusRuleID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &s.StorageAccountID) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &s.WorkspaceID) + 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 ServiceDiagnosticSettingsResource. +func (s ServiceDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + 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 ServiceDiagnosticSettingsResource. +func (s *ServiceDiagnosticSettingsResource) UnmarshalJSON(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 "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 ServiceDiagnosticSettingsResourcePatch. +func (s ServiceDiagnosticSettingsResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceDiagnosticSettingsResourcePatch. +func (s *ServiceDiagnosticSettingsResourcePatch) UnmarshalJSON(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 "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 SingleBaseline. func (s SingleBaseline) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9653,18 +8479,17 @@ func (s *SmsReceiver) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SmsReceiverAutoGenerated. -func (s SmsReceiverAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StaticPromQLCriteria. +func (s StaticPromQLCriteria) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "countryCode", s.CountryCode) + objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion populate(objectMap, "name", s.Name) - populate(objectMap, "phoneNumber", s.PhoneNumber) - populate(objectMap, "status", s.Status) + populate(objectMap, "query", s.Query) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiverAutoGenerated. -func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticPromQLCriteria. +func (s *StaticPromQLCriteria) UnmarshalJSON(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) @@ -9672,17 +8497,14 @@ func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &s.CountryCode) + case "criterionType": + err = unpopulate(val, "CriterionType", &s.CriterionType) 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) + case "query": + err = unpopulate(val, "Query", &s.Query) delete(rawMsg, key) } if err != nil { @@ -9692,17 +8514,18 @@ func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageBlobDestination. -func (s StorageBlobDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageBlob. +func (s StorageBlob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "containerName", s.ContainerName) + populate(objectMap, "blobUrl", s.BlobURL) + populate(objectMap, "lookupType", s.LookupType) populate(objectMap, "name", s.Name) - populate(objectMap, "storageAccountResourceId", s.StorageAccountResourceID) + populate(objectMap, "resourceId", s.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDestination. -func (s *StorageBlobDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlob. +func (s *StorageBlob) UnmarshalJSON(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) @@ -9710,14 +8533,17 @@ func (s *StorageBlobDestination) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &s.ContainerName) + case "blobUrl": + err = unpopulate(val, "BlobURL", &s.BlobURL) + delete(rawMsg, key) + case "lookupType": + err = unpopulate(val, "LookupType", &s.LookupType) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &s.StorageAccountResourceID) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) delete(rawMsg, key) } if err != nil { @@ -9727,17 +8553,17 @@ func (s *StorageBlobDestination) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageTableDestination. -func (s StorageTableDestination) MarshalJSON() ([]byte, error) { +// 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) - 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 { +// 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) @@ -9745,15 +8571,15 @@ func (s *StorageTableDestination) UnmarshalJSON(data []byte) error { 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) - case "tableName": - err = unpopulate(val, "TableName", &s.TableName) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -9762,15 +8588,17 @@ func (s *StorageTableDestination) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. -func (s StreamDeclaration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageTableDestination. +func (s StorageTableDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", s.Columns) + 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 StreamDeclaration. -func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { +// 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) @@ -9778,8 +8606,14 @@ func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &s.Columns) + 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 { @@ -9789,52 +8623,24 @@ func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { 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) +// 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 { @@ -9922,6 +8728,7 @@ func (s *SubscriptionScopeMetricDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinitionCollection. func (s SubscriptionScopeMetricDefinitionCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -9935,52 +8742,8 @@ func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) 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) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) @@ -10005,7 +8768,7 @@ func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, er populate(objectMap, "orderBy", s.OrderBy) populate(objectMap, "resultType", s.ResultType) populate(objectMap, "rollUpBy", s.RollUpBy) - populateTimeRFC3339(objectMap, "timespan", s.Timespan) + populate(objectMap, "timespan", s.Timespan) populate(objectMap, "top", s.Top) populate(objectMap, "validateDimensions", s.ValidateDimensions) return json.Marshal(objectMap) @@ -10048,7 +8811,7 @@ func (s *SubscriptionScopeMetricsRequestBodyParameters) UnmarshalJSON(data []byt err = unpopulate(val, "RollUpBy", &s.RollUpBy) delete(rawMsg, key) case "timespan": - err = unpopulateTimeRFC3339(val, "Timespan", &s.Timespan) + err = unpopulate(val, "Timespan", &s.Timespan) delete(rawMsg, key) case "top": err = unpopulate(val, "Top", &s.Top) @@ -10071,6 +8834,7 @@ func (s SyslogDataSource) MarshalJSON() ([]byte, error) { populate(objectMap, "logLevels", s.LogLevels) populate(objectMap, "name", s.Name) populate(objectMap, "streams", s.Streams) + populate(objectMap, "transformKql", s.TransformKql) return json.Marshal(objectMap) } @@ -10095,6 +8859,9 @@ func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &s.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &s.TransformKql) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10106,10 +8873,10 @@ func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { // 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) + populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -10125,7 +8892,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -10134,7 +8901,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -10177,135 +8944,6 @@ func (t *TagsResource) UnmarshalJSON(data []byte) error { 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) @@ -10349,53 +8987,6 @@ func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { 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) @@ -10403,92 +8994,16 @@ func (t TimeSeriesBaseline) MarshalJSON() ([]byte, error) { populate(objectMap, "data", t.Data) populate(objectMap, "dimensions", t.Dimensions) populate(objectMap, "metadataValues", t.MetadataValues) - aux := make([]*dateTimeRFC3339, len(t.Timestamps), len(t.Timestamps)) + aux := make([]*datetime.RFC3339, len(t.Timestamps), len(t.Timestamps)) for i := 0; i < len(t.Timestamps); i++ { - aux[i] = (*dateTimeRFC3339)(t.Timestamps[i]) + aux[i] = (*datetime.RFC3339)(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 { +// 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) @@ -10496,14 +9011,24 @@ func (t *TimeWindow) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "end": - err = unpopulateDateTimeRFC3339(val, "End", &t.End) + case "aggregation": + err = unpopulate(val, "Aggregation", &t.Aggregation) delete(rawMsg, key) - case "start": - err = unpopulateDateTimeRFC3339(val, "Start", &t.Start) + case "data": + err = unpopulate(val, "Data", &t.Data) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &t.TimeZone) + 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 []*datetime.RFC3339 + err = unpopulate(val, "Timestamps", &aux) + for _, au := range aux { + t.Timestamps = append(t.Timestamps, (*time.Time)(au)) + } delete(rawMsg, key) } if err != nil { @@ -10513,19 +9038,16 @@ func (t *TimeWindow) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement. +func (t TimeSeriesElement) 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) + populate(objectMap, "data", t.Data) + populate(objectMap, "metadatavalues", t.Metadatavalues) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// 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) @@ -10533,20 +9055,11 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { 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 "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "data": + err = unpopulate(val, "Data", &t.Data) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "metadatavalues": + err = unpopulate(val, "Metadatavalues", &t.Metadatavalues) delete(rawMsg, key) } if err != nil { @@ -10556,20 +9069,17 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResourceAutoGenerated. -func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TimeWindow. +func (t TimeWindow) 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) + populateTime[datetime.RFC3339](objectMap, "end", t.End) + populateTime[datetime.RFC3339](objectMap, "start", t.Start) + populate(objectMap, "timeZone", t.TimeZone) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceAutoGenerated. -func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { +// 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) @@ -10577,23 +9087,14 @@ func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { 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 "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + case "end": + err = unpopulateTime[datetime.RFC3339](val, "End", &t.End) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "start": + err = unpopulateTime[datetime.RFC3339](val, "Start", &t.Start) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "timeZone": + err = unpopulate(val, "TimeZone", &t.TimeZone) delete(rawMsg, key) } if err != nil { @@ -10665,84 +9166,6 @@ func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatus. -func (v VMInsightsOnboardingStatus) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatus. -func (v *VMInsightsOnboardingStatus) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) - 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) - delete(rawMsg, key) - case "dataStatus": - err = unpopulate(val, "DataStatus", &v.DataStatus) - delete(rawMsg, key) - case "onboardingStatus": - err = unpopulate(val, "OnboardingStatus", &v.OnboardingStatus) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &v.ResourceID) - 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 VoiceReceiver. func (v VoiceReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10778,41 +9201,6 @@ func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VoiceReceiverAutoGenerated. -func (v VoiceReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 VoiceReceiverAutoGenerated. -func (v *VoiceReceiverAutoGenerated) UnmarshalJSON(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 "countryCode": - err = unpopulate(val, "CountryCode", &v.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) - delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) - 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 WebhookNotification. func (w WebhookNotification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10848,6 +9236,7 @@ func (w *WebhookNotification) UnmarshalJSON(data []byte) error { func (w WebhookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) 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) @@ -10869,56 +9258,8 @@ func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { case "identifierUri": err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) 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 { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookReceiverAutoGenerated. -func (w WebhookReceiverAutoGenerated) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiverAutoGenerated. -func (w *WebhookReceiverAutoGenerated) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "identifierUri": - err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &w.ManagedIdentity) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &w.Name) @@ -11005,6 +9346,7 @@ func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", w.Name) populate(objectMap, "streams", w.Streams) + populate(objectMap, "transformKql", w.TransformKql) populate(objectMap, "xPathQueries", w.XPathQueries) return json.Marshal(objectMap) } @@ -11024,6 +9366,9 @@ func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { case "streams": err = unpopulate(val, "Streams", &w.Streams) delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &w.TransformKql) + delete(rawMsg, key) case "xPathQueries": err = unpopulate(val, "XPathQueries", &w.XPathQueries) delete(rawMsg, key) @@ -11039,6 +9384,7 @@ func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { func (w WindowsFirewallLogsDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", w.Name) + populate(objectMap, "profileFilter", w.ProfileFilter) populate(objectMap, "streams", w.Streams) return json.Marshal(objectMap) } @@ -11055,6 +9401,9 @@ func (w *WindowsFirewallLogsDataSource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) + case "profileFilter": + err = unpopulate(val, "ProfileFilter", &w.ProfileFilter) + delete(rawMsg, key) case "streams": err = unpopulate(val, "Streams", &w.Streams) delete(rawMsg, key) @@ -11066,68 +9415,6 @@ func (w *WindowsFirewallLogsDataSource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfo. -func (w WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "properties", w.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfo. -func (w *WorkspaceInfo) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfoProperties. -func (w WorkspaceInfoProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customerId", w.CustomerID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfoProperties. -func (w *WorkspaceInfoProperties) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "customerId": - err = unpopulate(val, "CustomerID", &w.CustomerID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - func populate(m map[string]any, k string, v any) { if v == nil { return @@ -11138,6 +9425,17 @@ func populate(m map[string]any, k string, v any) { } } +func populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + } else if !reflect.ValueOf(t).IsNil() { + newTime := T(*t) + m[k] = (*T)(&newTime) + } +} + func populateAny(m map[string]any, k string, v any) { if v == nil { return @@ -11149,7 +9447,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 { @@ -11157,3 +9455,20 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + +func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux T + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + newTime := time.Time(aux) + *t = &newTime + return nil +} + +type dateTimeConstraints interface { + datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix +} diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go deleted file mode 100644 index 230d29e594e4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 797b9b45f4ca..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,430 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 4199b9bd17ea..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 4a531ffd3790..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 e717cae015fc..c553faeb5057 100644 --- a/sdk/resourcemanager/monitor/armmonitor/options.go +++ b/sdk/resourcemanager/monitor/armmonitor/options.go @@ -1,14 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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 +} + +// ActionGroupsClientBeginReconcileNSPOptions contains the optional parameters for the ActionGroupsClient.BeginReconcileNSP +// method. +type ActionGroupsClientBeginReconcileNSPOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -27,6 +33,11 @@ type ActionGroupsClientEnableReceiverOptions struct { // placeholder for future optional parameters } +// ActionGroupsClientGetNSPOptions contains the optional parameters for the ActionGroupsClient.GetNSP method. +type ActionGroupsClientGetNSPOptions struct { + // placeholder for future optional parameters +} + // ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. type ActionGroupsClientGetOptions struct { // placeholder for future optional parameters @@ -50,6 +61,11 @@ type ActionGroupsClientListBySubscriptionIDOptions struct { // placeholder for future optional parameters } +// ActionGroupsClientListNSPOptions contains the optional parameters for the ActionGroupsClient.NewListNSPPager method. +type ActionGroupsClientListNSPOptions struct { + // placeholder for future optional parameters +} + // ActionGroupsClientUpdateOptions contains the optional parameters for the ActionGroupsClient.Update method. type ActionGroupsClientUpdateOptions struct { // placeholder for future optional parameters @@ -90,11 +106,10 @@ type ActivityLogAlertsClientUpdateOptions struct { // 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 + // 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 } @@ -109,38 +124,6 @@ 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 { @@ -174,67 +157,30 @@ 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' " + // 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' + // %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** Metricnames *string - // Metric namespace to query metric definitions for. + // Metric namespace that contains the requested metric names. Metricnamespace *string // Allows retrieving only metadata of the baseline. On data request all information is retrieved. @@ -243,15 +189,21 @@ type BaselinesClientListOptions struct { // 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'. + // The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. Timespan *string } +// DataCollectionEndpointsClientBeginReconcileNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.BeginReconcileNSP +// method. +type DataCollectionEndpointsClientBeginReconcileNSPOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + // DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create // method. type DataCollectionEndpointsClientCreateOptions struct { - // The payload - Body *DataCollectionEndpointResource + // placeholder for future optional parameters } // DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete @@ -260,6 +212,12 @@ type DataCollectionEndpointsClientDeleteOptions struct { // placeholder for future optional parameters } +// DataCollectionEndpointsClientGetNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.GetNSP +// method. +type DataCollectionEndpointsClientGetNSPOptions struct { + // placeholder for future optional parameters +} + // DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get method. type DataCollectionEndpointsClientGetOptions struct { // placeholder for future optional parameters @@ -277,18 +235,22 @@ type DataCollectionEndpointsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } +// DataCollectionEndpointsClientListNSPOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListNSPPager +// method. +type DataCollectionEndpointsClientListNSPOptions struct { + // placeholder for future optional parameters +} + // DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update // method. type DataCollectionEndpointsClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate + // placeholder for future optional parameters } // DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create // method. type DataCollectionRuleAssociationsClientCreateOptions struct { - // The payload - Body *DataCollectionRuleAssociationProxyOnlyResource + // placeholder for future optional parameters } // DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete @@ -318,18 +280,22 @@ type DataCollectionRuleAssociationsClientListByResourceOptions struct { // DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager // method. type DataCollectionRuleAssociationsClientListByRuleOptions struct { - // placeholder for future optional parameters + // (Optional) The continuation token for paginated responses + SkipToken *string + + // (Optional) The max number of items to return per page + Top *int32 } // DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create method. type DataCollectionRulesClientCreateOptions struct { - // The payload - Body *DataCollectionRuleResource + // placeholder for future optional parameters } // DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete method. type DataCollectionRulesClientDeleteOptions struct { - // placeholder for future optional parameters + // If set to 'true' then all associations of this data collection rule will also be deleted + DeleteAssociations *bool } // DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. @@ -351,40 +317,6 @@ type DataCollectionRulesClientListBySubscriptionOptions struct { // 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 } @@ -484,47 +416,51 @@ type MetricNamespacesClientListOptions struct { // method. type MetricsClientListAtSubscriptionScopeOptions struct { // The list of aggregation types (comma separated) to retrieve. + // *Examples: average, minimum, maximum* 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. + // 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 ‘’. + // 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. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested. + // *Examples: PT15M, PT1H, P1D, FULL* Interval *string - // The names of the metrics (comma separated) to retrieve. + // The names of the metrics (comma separated) to retrieve. Limit 20 metrics. 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. + // 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'. + // 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 'startDateTime_ISO/endDateTime_ISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. + // 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 @@ -536,50 +472,54 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // method. type MetricsClientListAtSubscriptionScopePostOptions struct { // The list of aggregation types (comma separated) to retrieve. + // *Examples: average, minimum, maximum* 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. + // supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false. AutoAdjustTimegrain *bool - // Parameters serialized in the body + // The request 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 ‘’. + // 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. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested. + // *Examples: PT15M, PT1H, P1D, FULL* Interval *string - // The names of the metrics (comma separated) to retrieve. + // The names of the metrics (comma separated) to retrieve. Limit 20 metrics. 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. + // 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'. + // 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 'startDateTime_ISO/endDateTime_ISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. + // 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 @@ -590,47 +530,51 @@ type MetricsClientListAtSubscriptionScopePostOptions struct { // MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. type MetricsClientListOptions struct { // The list of aggregation types (comma separated) to retrieve. + // *Examples: average, minimum, maximum* 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. + // 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 ‘’. + // 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. + // The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value + // that returns single datapoint for entire time span requested. + // *Examples: PT15M, PT1H, P1D, FULL* Interval *string - // The names of the metrics (comma separated) to retrieve. + // The names of the metrics (comma separated) to retrieve. Limit 20 metrics. 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. + // 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'. + // 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 'startDateTime_ISO/endDateTime_ISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // The maximum number of records to retrieve per resource ID in the request. + // 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 @@ -638,17 +582,6 @@ type MetricsClientListOptions struct { 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 @@ -657,14 +590,14 @@ type PredictiveMetricClientGetOptions struct { // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -700,14 +633,14 @@ type PrivateLinkScopeOperationStatusClientGetOptions struct { // PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate // method. type PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -720,13 +653,14 @@ type PrivateLinkScopedResourcesClientGetOptions struct { // PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager // method. type PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters + // The kind of the private link resource. Not specifying a kind will return scoped resources of all kinds. + Kind *string } // PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete // method. type PrivateLinkScopesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -757,6 +691,24 @@ type PrivateLinkScopesClientUpdateTagsOptions struct { // placeholder for future optional parameters } +// ScheduledQueryRuleClientBeginReconcileNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.BeginReconcileNSP +// method. +type ScheduledQueryRuleClientBeginReconcileNSPOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ScheduledQueryRuleClientGetNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.GetNSP method. +type ScheduledQueryRuleClientGetNSPOptions struct { + // placeholder for future optional parameters +} + +// ScheduledQueryRuleClientListNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.NewListNSPPager +// method. +type ScheduledQueryRuleClientListNSPOptions struct { + // placeholder for future optional parameters +} + // ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate // method. type ScheduledQueryRulesClientCreateOrUpdateOptions struct { @@ -790,60 +742,41 @@ type ScheduledQueryRulesClientUpdateOptions struct { // placeholder for future optional parameters } -// TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate +// ServiceDiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.CreateOrUpdate // method. -type TenantActionGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete method. -type TenantActionGroupsClientDeleteOptions struct { +type ServiceDiagnosticSettingsClientCreateOrUpdateOptions 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 +// ServiceDiagnosticSettingsClientGetOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.Get // method. -type TenantActionGroupsClientListByManagementGroupIDOptions struct { +type ServiceDiagnosticSettingsClientGetOptions struct { // placeholder for future optional parameters } -// TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update method. -type TenantActionGroupsClientUpdateOptions struct { +// ServiceDiagnosticSettingsClientUpdateOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.Update +// method. +type ServiceDiagnosticSettingsClientUpdateOptions 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. + // 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 + // 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 index 8b5bd9c01990..7e10d6cd7625 100644 --- a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go +++ b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go @@ -1,14 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor import "encoding/json" func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -19,6 +18,8 @@ func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricA switch m["odata.type"] { case string(OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): b = &MetricAlertMultipleResourceMultipleMetricCriteria{} + case string(OdatatypeMicrosoftAzureMonitorPromQLCriteria): + b = &PromQLCriteria{} case string(OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): b = &MetricAlertSingleResourceMultipleMetricCriteria{} case string(OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): @@ -33,7 +34,7 @@ func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricA } func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMetricCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -56,7 +57,7 @@ func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMe } func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([]MultiMetricCriteriaClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage @@ -74,22 +75,22 @@ func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } -func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassification, error) { - if rawMsg == nil { +func unmarshalMultiPromQLCriteriaClassification(rawMsg json.RawMessage) (MultiPromQLCriteriaClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { 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{} + var b MultiPromQLCriteriaClassification + switch m["criterionType"] { + case string(CriterionTypeDynamicThresholdCriterion): + b = &DynamicPromQLCriteria{} + case string(CriterionTypeStaticThresholdCriterion): + b = &StaticPromQLCriteria{} default: - b = &RuleAction{} + b = &MultiPromQLCriteria{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -97,17 +98,17 @@ func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassi return b, nil } -func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActionClassification, error) { - if rawMsg == nil { +func unmarshalMultiPromQLCriteriaClassificationArray(rawMsg json.RawMessage) ([]MultiPromQLCriteriaClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { return nil, err } - fArray := make([]RuleActionClassification, len(rawMessages)) + fArray := make([]MultiPromQLCriteriaClassification, len(rawMessages)) for index, rawMessage := range rawMessages { - f, err := unmarshalRuleActionClassification(rawMessage) + f, err := unmarshalMultiPromQLCriteriaClassification(rawMessage) if err != nil { return nil, err } @@ -115,51 +116,3 @@ func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActio } 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 index 3ffad8a7b26a..5ccd5b7806f6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PredictiveMetricClient contains the methods for the PredictiveMetric group. // Don't use this type directly, use NewPredictiveMetricClient() instead. +// +// Generated from API version 2022-10-01 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,15 +43,13 @@ func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCre // 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'. +// - timespan - The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. // - 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' +// 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) { @@ -76,7 +75,7 @@ func (client *PredictiveMetricClient) Get(ctx context.Context, resourceGroupName } // 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) { +func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, _ *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") @@ -95,13 +94,13 @@ func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("timespan", timespan) + reqQP.Set("aggregation", aggregation) + reqQP.Set("api-version", version20221001) 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() + reqQP.Set("metricNamespace", metricNamespace) + reqQP.Set("timespan", timespan) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go index 337041c41dbf..1d10b068ff44 100644 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2022-10-01/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,27 +29,30 @@ func ExamplePredictiveMetricClient_Get() { // 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), + // res = armmonitor.PredictiveMetricClientGetResponse{ + // PredictiveResponse: armmonitor.PredictiveResponse{ + // Data: []*armmonitor.PredictiveValue{ + // { + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:00:00Z"); return t}()), + // Value: to.Ptr[float64](123), + // }, + // { + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00Z"); return t}()), + // Value: to.Ptr[float64](120), + // }, + // { + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00Z"); return t}()), + // Value: to.Ptr[float64](88), + // }, + // { + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:03:00Z"); return t}()), + // Value: to.Ptr[float64](100), + // }, // }, - // { - // 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"), + // 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 index a852089361a3..28520bf4907e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +// +// Generated from API version 2023-06-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,11 +43,9 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // 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. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - 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) { @@ -68,8 +67,6 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // 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" @@ -92,8 +89,8 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Conte } // 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}" +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, _ *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") } @@ -115,9 +112,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -126,11 +124,9 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // 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. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - 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) { @@ -152,8 +148,6 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // 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" @@ -176,8 +170,8 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // 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}" +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, _ *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") } @@ -199,19 +193,16 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. 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"} + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - 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) { @@ -237,8 +228,8 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // 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}" +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, _ *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") } @@ -260,8 +251,8 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -277,8 +268,6 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // 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 @@ -306,8 +295,8 @@ func (client *PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx conte } // 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" +func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, _ *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") } @@ -325,8 +314,8 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go index 8151fa7a95a0..bbc97b6b60b8 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go @@ -1,132 +1,138 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + 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 poll 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("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), + // res = armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse{ + // 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), // }, - // 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + 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) } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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), - // }, + // res = armmonitor.PrivateEndpointConnectionsClientDeleteResponse{ // } } -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + 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) } - _, 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 = armmonitor.PrivateEndpointConnectionsClientGetResponse{ + // 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/PrivateEndpointConnectionList.json +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -137,39 +143,42 @@ func ExamplePrivateEndpointConnectionsClient_ListByPrivateLinkScope() { // 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), + // res = armmonitor.PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{ + // 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), // }, - // 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"), + // { + // 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), // }, - // 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 index 813e7c6e66da..109f0de66d56 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +// +// Generated from API version 2023-06-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,11 +43,9 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // 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. +// - groupName - The name of the private link associated with the Azure 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) { @@ -72,8 +71,8 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroup } // 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}" +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, groupName string, _ *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") } @@ -95,8 +94,8 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -112,8 +111,6 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // 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 @@ -141,8 +138,8 @@ func (client *PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Con } // 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" +func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, _ *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") } @@ -160,8 +157,8 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go index 8bed8afc6a3d..f70e1ba3ba91 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go @@ -1,102 +1,108 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) + 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.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")}, - // }, - // }}, - // } + // res = armmonitor.PrivateLinkResourcesClientGetResponse{ + // 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"), + // }, + // }, + // }, + // } } -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", nil) + 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.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")}, + // res = armmonitor.PrivateLinkResourcesClientListByPrivateLinkScopeResponse{ + // 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"), + // }, + // }, // }, - // } + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go index ab63348225a8..41fe625e0467 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PrivateLinkScopedResourcesClient contains the methods for the PrivateLinkScopedResources group. // Don't use this type directly, use NewPrivateLinkScopedResourcesClient() instead. +// +// Generated from API version 2023-06-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -40,10 +41,8 @@ func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcor return client, nil } -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. +// BeginCreateOrUpdate - Add an Azure monitor scoped resource in the 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. @@ -66,10 +65,8 @@ func (client *PrivateLinkScopedResourcesClient) BeginCreateOrUpdate(ctx context. } } -// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. +// CreateOrUpdate - Add an Azure monitor scoped resource in the private link scope. // 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" @@ -92,8 +89,8 @@ func (client *PrivateLinkScopedResourcesClient) createOrUpdate(ctx context.Conte } // 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}" +func (client *PrivateLinkScopedResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, _ *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") } @@ -115,19 +112,18 @@ func (client *PrivateLinkScopedResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []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. +// BeginDelete - Deletes an Azure monitor scoped resource 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. @@ -150,10 +146,8 @@ func (client *PrivateLinkScopedResourcesClient) BeginDelete(ctx context.Context, } } -// Delete - Deletes a private endpoint connection with a given name. +// Delete - Deletes an Azure monitor scoped resource 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" @@ -176,8 +170,8 @@ func (client *PrivateLinkScopedResourcesClient) deleteOperation(ctx context.Cont } // 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}" +func (client *PrivateLinkScopedResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, _ *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") } @@ -199,16 +193,13 @@ func (client *PrivateLinkScopedResourcesClient) deleteCreateRequest(ctx context. 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"} + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. @@ -237,8 +228,8 @@ func (client *PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourc } // 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}" +func (client *PrivateLinkScopedResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, _ *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") } @@ -260,8 +251,8 @@ func (client *PrivateLinkScopedResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -275,9 +266,7 @@ func (client *PrivateLinkScopedResourcesClient) getHandleResponse(resp *http.Res return result, nil } -// NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. -// -// Generated from API version 2021-07-01-preview +// NewListByPrivateLinkScopePager - Gets all scoped resources on a private link scope. // - 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 @@ -307,7 +296,7 @@ func (client *PrivateLinkScopedResourcesClient) NewListByPrivateLinkScopePager(r // 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" + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -325,8 +314,11 @@ func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + if options != nil && options.Kind != nil { + reqQP.Set("kind", *options.Kind) + } + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go index b95411566fa5..c56632699bb2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go @@ -1,71 +1,82 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2023-06-01-preview/PrivateLinkScopedResourceUpdate.json +func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate_updateAScopedResourceInAPrivateLinkScope() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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) + poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", armmonitor.ScopedResource{ + Properties: &armmonitor.ScopedResourceProperties{ + Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + 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 poll 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), + // res = armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse{ + // 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{ + // Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); 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() { +// Generated from example definition: 2023-06-01-preview/PrivateLinkScopedResourceUpdatePlatformMetrics.json +func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate_updateAScopedPlatformMetricsSubscriptionInAPrivateLinkScope() { 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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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"), + Kind: to.Ptr(armmonitor.ScopedResourceKind("PlatformMetrics")), + LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444"), + SubscriptionLocation: to.Ptr("eastus"), }, }, nil) if err != nil { @@ -73,38 +84,42 @@ func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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), + // res = armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse{ + // 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{ + // Kind: to.Ptr(armmonitor.ScopedResourceKind("PlatformMetrics")), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // SubscriptionLocation: to.Ptr("eastus"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); 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 +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -112,20 +127,65 @@ func ExamplePrivateLinkScopedResourcesClient_BeginDelete() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armmonitor.PrivateLinkScopedResourcesClientDeleteResponse{ + // } } -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", 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 = armmonitor.PrivateLinkScopedResourcesClientGetResponse{ + // 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{ + // Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2023-06-01-preview/PrivateLinkScopedResourceList.json +func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager_getsListOfScopedResourcesInAPrivateLinkScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -140,42 +200,135 @@ func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager() { _ = 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"), + // page = armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{ + // ScopedResourceListResult: armmonitor.ScopedResourceListResult{ + // Value: []*armmonitor.ScopedResource{ + // { + // Name: to.Ptr("scoped-resource-name-one"), + // 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-one"), + // Properties: &armmonitor.ScopedResourceProperties{ + // Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, // }, - // 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("scoped-resource-name-two"), + // 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-two"), + // Properties: &armmonitor.ScopedResourceProperties{ + // Kind: to.Ptr(armmonitor.ScopedResourceKind("PlatformMetrics")), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateProvisioning), + // SubscriptionLocation: to.Ptr("westus"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // }, + // { + // Name: to.Ptr("scoped-resource-name-three"), + // 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-three"), + // Properties: &armmonitor.ScopedResourceProperties{ + // Kind: to.Ptr(armmonitor.ScopedResourceKind("PlatformMetrics")), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // SubscriptionLocation: to.Ptr("eastus"), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); 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"), + // }, + // } + } +} + +// Generated from example definition: 2023-06-01-preview/PrivateLinkScopedResourceListKindFilter.json +func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager_getsListOfScopedResourcesInAPrivateLinkScopeFilteredByKind() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinkScopedResourcesClient().NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", &armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions{ + Kind: to.Ptr("Resource")}) + 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 = armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{ + // ScopedResourceListResult: armmonitor.ScopedResourceListResult{ + // Value: []*armmonitor.ScopedResource{ + // { + // Name: to.Ptr("scoped-resource-name-one"), + // 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-one"), + // Properties: &armmonitor.ScopedResourceProperties{ + // Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, // }, - // 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("scoped-resource-name-two"), + // 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-two"), + // Properties: &armmonitor.ScopedResourceProperties{ + // Kind: to.Ptr(armmonitor.ScopedResourceKindResource), + // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444/resourceGroups/MyWorkspaceResourceGroup/providers/Microsoft.OperationalInsights/workspaces/my-workspace"), + // ProvisioningState: to.Ptr(armmonitor.ScopedResourceProvisioningStateProvisioning), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); 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 index 4c9986b61f9e..d637a81e459c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PrivateLinkScopeOperationStatusClient contains the methods for the PrivateLinkScopeOperationStatus group. // Don't use this type directly, use NewPrivateLinkScopeOperationStatusClient() instead. +// +// Generated from API version 2023-06-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -42,19 +43,17 @@ func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential // 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. +// - asyncOperationID - The operation Id. // - 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) { +func (client *PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, resourceGroupName string, asyncOperationID 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) + req, err := client.getCreateRequest(ctx, resourceGroupName, asyncOperationID, options) if err != nil { return PrivateLinkScopeOperationStatusClientGetResponse{}, err } @@ -71,27 +70,27 @@ func (client *PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, as } // 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") +func (client *PrivateLinkScopeOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, asyncOperationID string, _ *PrivateLinkScopeOperationStatusClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopeOperationStatuses/{asyncOperationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) + 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 client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if asyncOperationID == "" { + return nil, errors.New("parameter asyncOperationID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) 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() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go index e71dc907dee2..9664737a9fa9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go @@ -1,42 +1,41 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("613192d7-503f-477a-9cfe-4efc3ee2bd60", 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) + res, err := clientFactory.NewPrivateLinkScopeOperationStatusClient().Get(ctx, "MyResourceGroup", "713192d7-503f-477a-9cfe-4efc3ee2bd11", 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"), + // res = armmonitor.PrivateLinkScopeOperationStatusClientGetResponse{ + // 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 index cc5bf3c1982b..e081b04d2cfe 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // PrivateLinkScopesClient contains the methods for the PrivateLinkScopes group. // Don't use this type directly, use NewPrivateLinkScopesClient() instead. +// +// Generated from API version 2023-06-01-preview 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. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. 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 { @@ -43,8 +44,6 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // 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. @@ -73,16 +72,16 @@ func (client *PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resou } // 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)) +func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, _ *PrivateLinkScopesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}" 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") } @@ -92,9 +91,10 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureMonitorPrivateLinkScopePayload); err != nil { return nil, err } @@ -112,8 +112,6 @@ func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.R // 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 @@ -137,8 +135,6 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource // 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" @@ -153,7 +149,7 @@ func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, reso if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -161,16 +157,16 @@ func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, reso } // 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)) +func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, _ *PrivateLinkScopesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}" 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") } @@ -180,16 +176,13 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, 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"} + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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. @@ -216,16 +209,16 @@ func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupNam } // 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)) +func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, _ *PrivateLinkScopesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}" 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") } @@ -235,8 +228,8 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -251,8 +244,6 @@ func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (P } // 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] { @@ -279,8 +270,8 @@ func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesCl } // listCreateRequest creates the List request. -func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, options *PrivateLinkScopesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes" +func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, _ *PrivateLinkScopesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/privateLinkScopes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -290,8 +281,8 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -306,8 +297,6 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( } // 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. @@ -335,23 +324,23 @@ func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroup } // 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)) +func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *PrivateLinkScopesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/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)) + 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-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -367,8 +356,6 @@ func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *h // 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. @@ -397,16 +384,16 @@ func (client *PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceG } // 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)) +func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, _ *PrivateLinkScopesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}" 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") } @@ -416,9 +403,10 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20230601Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go index 987668b2244b..04544283e1d6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go @@ -1,184 +1,141 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", 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), - // }, - // }}, - // } + 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 = armmonitor.PrivateLinkScopesClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // 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/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", 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), - // }, - // }}, - // } + 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), + }, + }, + Tags: map[string]*string{ + "Tag1": 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 = armmonitor.PrivateLinkScopesClientCreateOrUpdateResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "Tag1": to.Ptr("Value1"), + // }, + // }, + // } } -// 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 +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -188,18 +145,18 @@ func ExamplePrivateLinkScopesClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -210,153 +167,205 @@ func ExamplePrivateLinkScopesClient_Get() { // 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{ + // res = armmonitor.PrivateLinkScopesClientGetResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", 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) + 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 = armmonitor.PrivateLinkScopesClientListResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } } - // 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() { +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("86dc51d3-92ed-4d7e-947a-775ea79b4919", 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) + 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 = armmonitor.PrivateLinkScopesClientListByResourceGroupResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // }, + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } } - // 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 +// Generated from example definition: 2023-06-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("subid", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -372,31 +381,33 @@ func ExamplePrivateLinkScopesClient_UpdateTags() { // 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{ + // res = armmonitor.PrivateLinkScopesClientUpdateTagsResponse{ + // 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"), + // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ + // AccessModeSettings: &armmonitor.AccessModeSettings{ + // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ + // }, + // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), + // ProvisioningState: to.Ptr(armmonitor.PrivateLinkScopeProvisioningStateSucceeded), + // }, + // SystemData: &armmonitor.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051056Z"); 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.051056Z"); return t}()), + // LastModifiedBy: to.Ptr("bobby@contoso.com"), + // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "Tag1": to.Ptr("Value1"), + // "Tag2": to.Ptr("Value2"), // }, - // 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/responses.go similarity index 75% rename from sdk/resourcemanager/monitor/armmonitor/response_types.go rename to sdk/resourcemanager/monitor/armmonitor/responses.go index be030e71693f..c8c543b76508 100644 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/responses.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -27,6 +26,12 @@ type ActionGroupsClientEnableReceiverResponse struct { // placeholder for future response values } +// ActionGroupsClientGetNSPResponse contains the response from method ActionGroupsClient.GetNSP. +type ActionGroupsClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + // ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. type ActionGroupsClientGetResponse struct { // An action group resource. @@ -51,6 +56,17 @@ type ActionGroupsClientListBySubscriptionIDResponse struct { ActionGroupList } +// ActionGroupsClientListNSPResponse contains the response from method ActionGroupsClient.NewListNSPPager. +type ActionGroupsClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// ActionGroupsClientReconcileNSPResponse contains the response from method ActionGroupsClient.BeginReconcileNSP. +type ActionGroupsClientReconcileNSPResponse struct { + // placeholder for future response values +} + // ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. type ActionGroupsClientUpdateResponse struct { // An action group resource. @@ -110,41 +126,6 @@ type AlertRuleIncidentsClientListByAlertRuleResponse struct { 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. @@ -180,41 +161,6 @@ type AutoscaleSettingsClientUpdateResponse struct { 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. @@ -232,6 +178,12 @@ type DataCollectionEndpointsClientDeleteResponse struct { // placeholder for future response values } +// DataCollectionEndpointsClientGetNSPResponse contains the response from method DataCollectionEndpointsClient.GetNSP. +type DataCollectionEndpointsClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + // DataCollectionEndpointsClientGetResponse contains the response from method DataCollectionEndpointsClient.Get. type DataCollectionEndpointsClientGetResponse struct { // Definition of ARM tracked top level resource. @@ -240,16 +192,27 @@ type DataCollectionEndpointsClientGetResponse struct { // DataCollectionEndpointsClientListByResourceGroupResponse contains the response from method DataCollectionEndpointsClient.NewListByResourceGroupPager. type DataCollectionEndpointsClientListByResourceGroupResponse struct { - // A pageable list of resources. + // The response of a DataCollectionEndpointResource list operation. DataCollectionEndpointResourceListResult } // DataCollectionEndpointsClientListBySubscriptionResponse contains the response from method DataCollectionEndpointsClient.NewListBySubscriptionPager. type DataCollectionEndpointsClientListBySubscriptionResponse struct { - // A pageable list of resources. + // The response of a DataCollectionEndpointResource list operation. DataCollectionEndpointResourceListResult } +// DataCollectionEndpointsClientListNSPResponse contains the response from method DataCollectionEndpointsClient.NewListNSPPager. +type DataCollectionEndpointsClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// DataCollectionEndpointsClientReconcileNSPResponse contains the response from method DataCollectionEndpointsClient.BeginReconcileNSP. +type DataCollectionEndpointsClientReconcileNSPResponse struct { + // placeholder for future response values +} + // DataCollectionEndpointsClientUpdateResponse contains the response from method DataCollectionEndpointsClient.Update. type DataCollectionEndpointsClientUpdateResponse struct { // Definition of ARM tracked top level resource. @@ -275,19 +238,19 @@ type DataCollectionRuleAssociationsClientGetResponse struct { // DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager. type DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse struct { - // A pageable list of resources. + // The response of a DataCollectionRuleAssociationProxyOnlyResource list operation. DataCollectionRuleAssociationProxyOnlyResourceListResult } // DataCollectionRuleAssociationsClientListByResourceResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByResourcePager. type DataCollectionRuleAssociationsClientListByResourceResponse struct { - // A pageable list of resources. + // The response of a DataCollectionRuleAssociationProxyOnlyResource list operation. DataCollectionRuleAssociationProxyOnlyResourceListResult } // DataCollectionRuleAssociationsClientListByRuleResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByRulePager. type DataCollectionRuleAssociationsClientListByRuleResponse struct { - // A pageable list of resources. + // The response of a DataCollectionRuleAssociationProxyOnlyResource list operation. DataCollectionRuleAssociationProxyOnlyResourceListResult } @@ -310,13 +273,13 @@ type DataCollectionRulesClientGetResponse struct { // DataCollectionRulesClientListByResourceGroupResponse contains the response from method DataCollectionRulesClient.NewListByResourceGroupPager. type DataCollectionRulesClientListByResourceGroupResponse struct { - // A pageable list of resources. + // The response of a DataCollectionRuleResource list operation. DataCollectionRuleResourceListResult } // DataCollectionRulesClientListBySubscriptionResponse contains the response from method DataCollectionRulesClient.NewListBySubscriptionPager. type DataCollectionRulesClientListBySubscriptionResponse struct { - // A pageable list of resources. + // The response of a DataCollectionRuleResource list operation. DataCollectionRuleResourceListResult } @@ -326,41 +289,6 @@ type DataCollectionRulesClientUpdateResponse struct { 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, @@ -464,14 +392,14 @@ type MetricNamespacesClientListResponse struct { // MetricsClientListAtSubscriptionScopePostResponse contains the response from method MetricsClient.ListAtSubscriptionScopePost. type MetricsClientListAtSubscriptionScopePostResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse + // The response to a metrics query. + Response } // MetricsClientListAtSubscriptionScopeResponse contains the response from method MetricsClient.ListAtSubscriptionScope. type MetricsClientListAtSubscriptionScopeResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse + // The response to a metrics query. + Response } // MetricsClientListResponse contains the response from method MetricsClient.List. @@ -480,19 +408,6 @@ type MetricsClientListResponse struct { 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. @@ -530,7 +445,7 @@ type PrivateLinkResourcesClientGetResponse struct { // PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.ListByPrivateLinkScope. type PrivateLinkResourcesClientListByPrivateLinkScopeResponse struct { - // A list of private link resources + // The response of a PrivateLinkResource list operation. PrivateLinkResourceListResult } @@ -559,7 +474,7 @@ type PrivateLinkScopedResourcesClientGetResponse struct { // PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager. type PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse struct { - // A list of scoped resources in a private link scope. + // The response of a ScopedResource list operation. ScopedResourceListResult } @@ -582,13 +497,13 @@ type PrivateLinkScopesClientGetResponse struct { // PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. type PrivateLinkScopesClientListByResourceGroupResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. + // The response of a AzureMonitorPrivateLinkScope list operation. AzureMonitorPrivateLinkScopeListResult } // PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. type PrivateLinkScopesClientListResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. + // The response of a AzureMonitorPrivateLinkScope list operation. AzureMonitorPrivateLinkScopeListResult } @@ -598,6 +513,23 @@ type PrivateLinkScopesClientUpdateTagsResponse struct { AzureMonitorPrivateLinkScope } +// ScheduledQueryRuleClientGetNSPResponse contains the response from method ScheduledQueryRuleClient.GetNSP. +type ScheduledQueryRuleClientGetNSPResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + +// ScheduledQueryRuleClientListNSPResponse contains the response from method ScheduledQueryRuleClient.NewListNSPPager. +type ScheduledQueryRuleClientListNSPResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// ScheduledQueryRuleClientReconcileNSPResponse contains the response from method ScheduledQueryRuleClient.BeginReconcileNSP. +type ScheduledQueryRuleClientReconcileNSPResponse struct { + // placeholder for future response values +} + // ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. type ScheduledQueryRulesClientCreateOrUpdateResponse struct { // The scheduled query rule resource. @@ -633,33 +565,22 @@ type ScheduledQueryRulesClientUpdateResponse struct { 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 +// ServiceDiagnosticSettingsClientCreateOrUpdateResponse contains the response from method ServiceDiagnosticSettingsClient.CreateOrUpdate. +type ServiceDiagnosticSettingsClientCreateOrUpdateResponse struct { + // Description of a service diagnostic setting + ServiceDiagnosticSettingsResource } -// TenantActionGroupsClientGetResponse contains the response from method TenantActionGroupsClient.Get. -type TenantActionGroupsClientGetResponse struct { - // A tenant action group resource. - TenantActionGroupResource +// ServiceDiagnosticSettingsClientGetResponse contains the response from method ServiceDiagnosticSettingsClient.Get. +type ServiceDiagnosticSettingsClientGetResponse struct { + // Description of a service diagnostic setting + ServiceDiagnosticSettingsResource } -// 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 +// ServiceDiagnosticSettingsClientUpdateResponse contains the response from method ServiceDiagnosticSettingsClient.Update. +type ServiceDiagnosticSettingsClientUpdateResponse struct { + // Description of a service diagnostic setting + ServiceDiagnosticSettingsResource } // TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.NewListPager. @@ -667,9 +588,3 @@ 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/scheduledqueryrule_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go new file mode 100644 index 000000000000..250652c628df --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client.go @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +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" +) + +// ScheduledQueryRuleClient contains the methods for the ScheduledQueryRule group. +// Don't use this type directly, use NewScheduledQueryRuleClient() instead. +// +// Generated from API version 2021-10-01 +type ScheduledQueryRuleClient struct { + internal *arm.Client + subscriptionID string +} + +// NewScheduledQueryRuleClient creates a new instance of ScheduledQueryRuleClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewScheduledQueryRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRuleClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScheduledQueryRuleClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetNSP - Gets a network security perimeter configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ScheduledQueryRuleClientGetNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.GetNSP +// method. +func (client *ScheduledQueryRuleClient) GetNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientGetNSPOptions) (ScheduledQueryRuleClientGetNSPResponse, error) { + var err error + const operationName = "ScheduledQueryRuleClient.GetNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getNSPCreateRequest(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + resp, err := client.getNSPHandleResponse(httpResp) + return resp, err +} + +// getNSPCreateRequest creates the GetNSP request. +func (client *ScheduledQueryRuleClient) getNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, _ *ScheduledQueryRuleClientGetNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + 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 networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getNSPHandleResponse handles the GetNSP response. +func (client *ScheduledQueryRuleClient) getNSPHandleResponse(resp *http.Response) (ScheduledQueryRuleClientGetNSPResponse, error) { + result := ScheduledQueryRuleClientGetNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return ScheduledQueryRuleClientGetNSPResponse{}, err + } + return result, nil +} + +// NewListNSPPager - Gets a list of NSP configurations for specified scheduled query rule. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - ScheduledQueryRuleClientListNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.NewListNSPPager +// method. +func (client *ScheduledQueryRuleClient) NewListNSPPager(resourceGroupName string, ruleName string, options *ScheduledQueryRuleClientListNSPOptions) *runtime.Pager[ScheduledQueryRuleClientListNSPResponse] { + return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRuleClientListNSPResponse]{ + More: func(page ScheduledQueryRuleClientListNSPResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScheduledQueryRuleClientListNSPResponse) (ScheduledQueryRuleClientListNSPResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ScheduledQueryRuleClient.NewListNSPPager") + 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.listNSPCreateRequest(ctx, resourceGroupName, ruleName, options) + }, nil) + if err != nil { + return ScheduledQueryRuleClientListNSPResponse{}, err + } + return client.listNSPHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listNSPCreateRequest creates the ListNSP request. +func (client *ScheduledQueryRuleClient) listNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *ScheduledQueryRuleClientListNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations" + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listNSPHandleResponse handles the ListNSP response. +func (client *ScheduledQueryRuleClient) listNSPHandleResponse(resp *http.Response) (ScheduledQueryRuleClientListNSPResponse, error) { + result := ScheduledQueryRuleClientListNSPResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return ScheduledQueryRuleClientListNSPResponse{}, err + } + return result, nil +} + +// BeginReconcileNSP - Reconcile network security perimeter configuration for ScheduledQueryRule resource. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - networkSecurityPerimeterConfigurationName - The name for a network security perimeter configuration +// - options - ScheduledQueryRuleClientBeginReconcileNSPOptions contains the optional parameters for the ScheduledQueryRuleClient.BeginReconcileNSP +// method. +func (client *ScheduledQueryRuleClient) BeginReconcileNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*runtime.Poller[ScheduledQueryRuleClientReconcileNSPResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcileNSP(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScheduledQueryRuleClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ScheduledQueryRuleClientReconcileNSPResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReconcileNSP - Reconcile network security perimeter configuration for ScheduledQueryRule resource. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ScheduledQueryRuleClient) reconcileNSP(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, options *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*http.Response, error) { + var err error + const operationName = "ScheduledQueryRuleClient.BeginReconcileNSP" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileNSPCreateRequest(ctx, resourceGroupName, ruleName, networkSecurityPerimeterConfigurationName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileNSPCreateRequest creates the ReconcileNSP request. +func (client *ScheduledQueryRuleClient) reconcileNSPCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, networkSecurityPerimeterConfigurationName string, _ *ScheduledQueryRuleClientBeginReconcileNSPOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + 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 networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + 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", version20211001) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client_example_test.go new file mode 100644 index 000000000000..f7bfac82dd17 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrule_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmonitor_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "log" +) + +// Generated from example definition: 2021-10-01/NSPForScheduledQueryRule_Get.json +func ExampleScheduledQueryRuleClient_GetNSP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledQueryRuleClient().GetNSP(ctx, "exampleRG", "someRule", "somePerimeterConfiguration", 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 = armmonitor.ScheduledQueryRuleClientGetNSPResponse{ + // NetworkSecurityPerimeterConfiguration: armmonitor.NetworkSecurityPerimeterConfiguration{ + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/scheduledQueryRules/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/scheduledQueryRules/someRule/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01/NSPForScheduledQueryRule_List.json +func ExampleScheduledQueryRuleClient_NewListNSPPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScheduledQueryRuleClient().NewListNSPPager("exampleRG", "someRule", 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 = armmonitor.ScheduledQueryRuleClientListNSPResponse{ + // NetworkSecurityPerimeterConfigurationListResult: armmonitor.NetworkSecurityPerimeterConfigurationListResult{ + // Value: []*armmonitor.NetworkSecurityPerimeterConfiguration{ + // { + // Name: to.Ptr("somePerimeterConfiguration"), + // Type: to.Ptr("Microsoft.Insights/scheduledQueryRules/networkSecurityPerimeterConfigurations"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/exampleRG/providers/Microsoft.Insights/scheduledQueryRules/someRule/networkSecurityPerimeterConfigurations/somePerimeterConfiguration"), + // Properties: &armmonitor.NetworkSecurityPerimeterConfigurationProperties{ + // NetworkSecurityPerimeter: &armmonitor.NetworkSecurityPerimeter{ + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityPerimeters/perimeter1"), + // Location: to.Ptr("japaneast"), + // }, + // Profile: &armmonitor.NetworkSecurityProfile{ + // Name: to.Ptr("profile1"), + // AccessRules: []*armmonitor.AccessRule{ + // { + // Name: to.Ptr("rule1"), + // Properties: &armmonitor.AccessRuleProperties{ + // AddressPrefixes: []*string{ + // to.Ptr("148.0.0.0/8"), + // to.Ptr("152.4.6.0/24"), + // }, + // Direction: to.Ptr(armmonitor.AccessRuleDirectionInbound), + // }, + // }, + // }, + // AccessRulesVersion: to.Ptr[int32](0), + // }, + // ProvisioningState: to.Ptr(armmonitor.NetworkSecurityPerimeterConfigurationProvisioningStateAccepted), + // ResourceAssociation: &armmonitor.ResourceAssociation{ + // Name: to.Ptr("assoc1"), + // AccessMode: to.Ptr(armmonitor.ResourceAssociationAccessModeEnforced), + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2021-10-01/NSPForScheduledQueryRule_Reconcile.json +func ExampleScheduledQueryRuleClient_BeginReconcileNSP() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmonitor.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewScheduledQueryRuleClient().BeginReconcileNSP(ctx, "exampleRG", "someRule", "somePerimeterConfiguration", 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 poll the result: %v", err) + } +} diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 5ebe6be29ed1..63616373f046 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -19,15 +18,17 @@ import ( // ScheduledQueryRulesClient contains the methods for the ScheduledQueryRules group. // Don't use this type directly, use NewScheduledQueryRulesClient() instead. +// +// Generated from API version 2025-01-01-preview type ScheduledQueryRulesClient struct { internal *arm.Client subscriptionID string } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRulesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ 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 // - 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. @@ -72,8 +71,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +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") } @@ -91,9 +90,10 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -111,8 +111,6 @@ 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 // - 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 @@ -139,8 +137,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +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") } @@ -158,16 +156,13 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // 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 // - 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. @@ -194,8 +189,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +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") } @@ -213,8 +208,8 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -229,8 +224,6 @@ 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 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager // method. @@ -258,8 +251,8 @@ func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules" +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") } @@ -273,8 +266,8 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -289,8 +282,6 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp } // NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. -// -// Generated from API version 2022-08-01-preview // - options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager // method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { @@ -317,7 +308,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") @@ -328,8 +319,8 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -345,8 +336,6 @@ 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 // - 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. @@ -375,8 +364,8 @@ 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) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +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") } @@ -394,9 +383,10 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250101Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go index eb4144b1de70..ae9d75255b66 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go @@ -1,330 +1,110 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" + "time" ) -// 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() { +// Generated from example definition: 2025-01-01-preview/createOrUpdateDynamicThresholdScheduledQueryRule.json +func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateDynamicThresholdScheduledQueryRuleOnSubscription() { 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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledQueryRulesClient().Get(ctx, "QueryResourceGroupName", "perf", nil) + 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"), + }, + ActionProperties: map[string]*string{ + "Icm.Title": to.Ptr("Custom title in ICM"), + "Icm.TsgId": to.Ptr("https://tsg.url"), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), + }, + }, + CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), + Criteria: &armmonitor.ScheduledQueryRuleCriteria{ + AllOf: []*armmonitor.Condition{ + { + AlertSensitivity: to.Ptr("Medium"), + CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), + 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("*"), + }, + }, + }, + IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-06-01T21:00:00.000Z"); return t }()), + MetricMeasureColumn: to.Ptr("% Processor Time"), + Operator: to.Ptr(armmonitor.ConditionOperatorGreaterOrLessThan), + Query: to.Ptr("Perf | where ObjectName == \"Processor\""), + ResourceIDColumn: to.Ptr("resourceId"), + TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), + }, + }, + }, + Enabled: to.Ptr(true), + EvaluationFrequency: to.Ptr("PT5M"), + MuteActionsDuration: to.Ptr("PT30M"), + Scopes: []*string{ + to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + }, + Severity: to.Ptr(armmonitor.AlertSeverityFour), + 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")}, + // res = armmonitor.ScheduledQueryRulesClientCreateOrUpdateResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, // CustomProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), @@ -334,58 +114,58 @@ func ExampleScheduledQueryRulesClient_Get() { // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ // AllOf: []*armmonitor.Condition{ // { + // AlertSensitivity: to.Ptr("Medium"), + // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), // Dimensions: []*armmonitor.Dimension{ // { // Name: to.Ptr("ComputerIp"), // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), // Values: []*string{ - // to.Ptr("192.168.1.1")}, + // 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), + // }, + // { + // Name: to.Ptr("OSType"), + // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), + // Values: []*string{ + // to.Ptr("*"), // }, - // 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{ + // }, + // }, + // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-06-01T21:00:00.000Z"); return t}()), + // MetricMeasureColumn: to.Ptr("% Processor Time"), + // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterOrLessThan), + // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), + // ResourceIDColumn: to.Ptr("resourceId"), + // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), // }, - // } + // }, + // }, + // Enabled: to.Ptr(true), + // EvaluationFrequency: to.Ptr("PT5M"), + // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), + // MuteActionsDuration: to.Ptr("PT30M"), + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // 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 +// Generated from example definition: 2025-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -395,7 +175,12 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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")}, + to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"), + }, + ActionProperties: map[string]*string{ + "Icm.Title": to.Ptr("Custom title in ICM"), + "Icm.TsgId": to.Ptr("https://tsg.url"), + }, CustomProperties: map[string]*string{ "key11": to.Ptr("value11"), "key12": to.Ptr("value12"), @@ -410,14 +195,17 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue Name: to.Ptr("ComputerIp"), Operator: to.Ptr(armmonitor.DimensionOperatorExclude), Values: []*string{ - to.Ptr("192.168.1.1")}, + to.Ptr("192.168.1.1"), + }, }, { Name: to.Ptr("OSType"), Operator: to.Ptr(armmonitor.DimensionOperatorInclude), Values: []*string{ - to.Ptr("*")}, - }}, + to.Ptr("*"), + }, + }, + }, FailingPeriods: &armmonitor.ConditionFailingPeriods{ MinFailingPeriodsToAlert: to.Ptr[int64](1), NumberOfEvaluationPeriods: to.Ptr[int64](1), @@ -428,18 +216,20 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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{ + ResolveConfiguration: &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)), + to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + }, + Severity: to.Ptr(armmonitor.AlertSeverityFour), SkipQueryValidation: to.Ptr(true), WindowSize: to.Ptr("PT10M"), }, @@ -450,16 +240,22 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // 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")}, + // res = armmonitor.ScheduledQueryRulesClientCreateOrUpdateResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, // CustomProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), @@ -474,53 +270,59 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // Name: to.Ptr("ComputerIp"), // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), // Values: []*string{ - // to.Ptr("192.168.1.1")}, + // 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), + // }, + // { + // Name: to.Ptr("OSType"), + // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), + // Values: []*string{ + // to.Ptr("*"), // }, - // 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{ + // }, + // }, + // 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"), + // ResolveConfiguration: &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.AlertSeverityFour), + // 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 +// Generated from example definition: 2025-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -530,7 +332,12 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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")}, + to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"), + }, + ActionProperties: map[string]*string{ + "Icm.Title": to.Ptr("Custom title in ICM"), + "Icm.TsgId": to.Ptr("https://tsg.url"), + }, CustomProperties: map[string]*string{ "key11": to.Ptr("value11"), "key12": to.Ptr("value12"), @@ -549,21 +356,24 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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{ + ResolveConfiguration: &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)), + to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1"), + }, + Severity: to.Ptr(armmonitor.AlertSeverityFour), SkipQueryValidation: to.Ptr(true), TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, + to.Ptr("Microsoft.Compute/virtualMachines"), + }, WindowSize: to.Ptr("PT10M"), }, }, nil) @@ -573,16 +383,22 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // 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")}, + // res = armmonitor.ScheduledQueryRulesClientCreateOrUpdateResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, // CustomProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), @@ -602,37 +418,41 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // 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{ + // ResolveConfiguration: &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{ - // }, - // } + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // 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 +// Generated from example definition: 2025-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -642,7 +462,12 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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")}, + to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"), + }, + ActionProperties: map[string]*string{ + "Icm.Title": to.Ptr("Custom title in ICM"), + "Icm.TsgId": to.Ptr("https://tsg.url"), + }, CustomProperties: map[string]*string{ "key11": to.Ptr("value11"), "key12": to.Ptr("value12"), @@ -657,14 +482,17 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue Name: to.Ptr("ComputerIp"), Operator: to.Ptr(armmonitor.DimensionOperatorExclude), Values: []*string{ - to.Ptr("192.168.1.1")}, + to.Ptr("192.168.1.1"), + }, }, { Name: to.Ptr("OSType"), Operator: to.Ptr(armmonitor.DimensionOperatorInclude), Values: []*string{ - to.Ptr("*")}, - }}, + to.Ptr("*"), + }, + }, + }, FailingPeriods: &armmonitor.ConditionFailingPeriods{ MinFailingPeriodsToAlert: to.Ptr[int64](1), NumberOfEvaluationPeriods: to.Ptr[int64](1), @@ -675,21 +503,24 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue 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{ + ResolveConfiguration: &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)), + to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"), + }, + Severity: to.Ptr(armmonitor.AlertSeverityFour), SkipQueryValidation: to.Ptr(true), TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, + to.Ptr("Microsoft.Compute/virtualMachines"), + }, WindowSize: to.Ptr("PT10M"), }, }, nil) @@ -699,16 +530,22 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // 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")}, + // res = armmonitor.ScheduledQueryRulesClientCreateOrUpdateResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, // CustomProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), @@ -723,134 +560,672 @@ func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQue // Name: to.Ptr("ComputerIp"), // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), // Values: []*string{ - // to.Ptr("192.168.1.1")}, + // 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), + // }, + // { + // Name: to.Ptr("OSType"), + // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), + // Values: []*string{ + // to.Ptr("*"), // }, - // 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{ + // 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"), + // ResolveConfiguration: &armmonitor.RuleResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // 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() { +// Generated from example definition: 2025-01-01-preview/createOrUpdateSimpleLogAlertScheduledQueryRule.json +func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateASimpleLogAlertScheduledQueryRuleOnSubscription() { 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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledQueryRulesClient().Update(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResourcePatch{ + res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ + Kind: to.Ptr(armmonitor.KindSimpleLogAlert), + Location: to.Ptr("eastus"), 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{ - // { + 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"), + }, + ActionProperties: map[string]*string{ + "Icm.Title": to.Ptr("Custom title in ICM"), + "Icm.TsgId": to.Ptr("https://tsg.url"), + }, + CustomProperties: map[string]*string{ + "key11": to.Ptr("value11"), + "key12": to.Ptr("value12"), + }, + }, + AutoMitigate: to.Ptr(false), + CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), + Criteria: &armmonitor.ScheduledQueryRuleCriteria{ + AllOf: []*armmonitor.Condition{ + { + Query: to.Ptr("Perf | where ObjectName == \"Processor\""), + }, + }, + }, + Enabled: to.Ptr(true), + Scopes: []*string{ + to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + }, + Severity: to.Ptr(armmonitor.AlertSeverityFour), + SkipQueryValidation: 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 = armmonitor.ScheduledQueryRulesClientCreateOrUpdateResponse{ + // 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"), + // Kind: to.Ptr(armmonitor.KindSimpleLogAlert), + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // CustomProperties: map[string]*string{ + // "key11": to.Ptr("value11"), + // "key12": to.Ptr("value12"), + // }, + // }, + // AutoMitigate: to.Ptr(false), + // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), + // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ + // AllOf: []*armmonitor.Condition{ + // { + // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), + // }, + // }, + // }, + // Enabled: to.Ptr(true), + // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // SkipQueryValidation: to.Ptr(true), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01-preview/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("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", 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 = armmonitor.ScheduledQueryRulesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-01-01-preview/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("dd4bfc94-a096-412b-9c43-4bd13e35afbc", 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 = armmonitor.ScheduledQueryRulesClientGetResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, + // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), + // ResourceIDColumn: to.Ptr("resourceId"), + // Threshold: to.Ptr[float64](70), + // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), + // }, + // }, // }, - // Enabled: to.Ptr(false), + // Enabled: to.Ptr(true), // EvaluationFrequency: to.Ptr("PT5M"), // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ + // ResolveConfiguration: &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{ - // }, - // } + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // 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/deleteScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Delete() { +// Generated from example definition: 2025-01-01-preview/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) + clientFactory, err := armmonitor.NewClientFactory("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) + 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 = armmonitor.ScheduledQueryRulesClientListByResourceGroupResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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"), + // ResolveConfiguration: &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.AlertSeverityFour), + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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"), + // ResolveConfiguration: &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.AlertSeverityFour), + // SkipQueryValidation: to.Ptr(true), + // TargetResourceTypes: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines"), + // }, + // WindowSize: to.Ptr("PT10M"), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-01-01-preview/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("dd4bfc94-a096-412b-9c43-4bd13e35afbc", 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 = armmonitor.ScheduledQueryRulesClientListBySubscriptionResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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"), + // ResolveConfiguration: &armmonitor.RuleResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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"), + // ResolveConfiguration: &armmonitor.RuleResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // SkipQueryValidation: to.Ptr(true), + // TargetResourceTypes: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines"), + // }, + // WindowSize: to.Ptr("PT10M"), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-01-01-preview/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("dd4bfc94-a096-412b-9c43-4bd13e35afbc", 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 = armmonitor.ScheduledQueryRulesClientUpdateResponse{ + // 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"), + // }, + // ActionProperties: map[string]*string{ + // "Icm.Title": to.Ptr("Custom title in ICM"), + // "Icm.TsgId": to.Ptr("https://tsg.url"), + // }, + // 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"), + // ResolveConfiguration: &armmonitor.RuleResolveConfiguration{ + // AutoResolved: to.Ptr(true), + // TimeToResolve: to.Ptr("PT10M"), + // }, + // Scopes: []*string{ + // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"), + // }, + // Severity: to.Ptr( armmonitor.AlertSeverityFour), + // SkipQueryValidation: to.Ptr(true), + // TargetResourceTypes: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines"), + // }, + // WindowSize: to.Ptr("PT10M"), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } diff --git a/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client.go new file mode 100644 index 000000000000..1d09ad11e037 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client.go @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +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" + "strings" +) + +// ServiceDiagnosticSettingsClient contains the methods for the ServiceDiagnosticSettings group. +// Don't use this type directly, use NewServiceDiagnosticSettingsClient() instead. +// +// Generated from API version 2016-09-01 +type ServiceDiagnosticSettingsClient struct { + internal *arm.Client +} + +// NewServiceDiagnosticSettingsClient creates a new instance of ServiceDiagnosticSettingsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewServiceDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceDiagnosticSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceDiagnosticSettingsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update new diagnostic settings for the specified resource. **WARNING**: This method will be +// deprecated in future releases. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - parameters - Parameters supplied to the operation. +// - options - ServiceDiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.CreateOrUpdate +// method. +func (client *ServiceDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters ServiceDiagnosticSettingsResource, options *ServiceDiagnosticSettingsClientCreateOrUpdateOptions) (ServiceDiagnosticSettingsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ServiceDiagnosticSettingsClient.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, parameters, options) + if err != nil { + return ServiceDiagnosticSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceDiagnosticSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceDiagnosticSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ServiceDiagnosticSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, parameters ServiceDiagnosticSettingsResource, _ *ServiceDiagnosticSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + 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", version20160901) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ServiceDiagnosticSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (ServiceDiagnosticSettingsClientCreateOrUpdateResponse, error) { + result := ServiceDiagnosticSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceDiagnosticSettingsResource); err != nil { + return ServiceDiagnosticSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets the active diagnostic settings for the specified resource. **WARNING**: This method will be deprecated in future +// releases. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - options - ServiceDiagnosticSettingsClientGetOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.Get +// method. +func (client *ServiceDiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, options *ServiceDiagnosticSettingsClientGetOptions) (ServiceDiagnosticSettingsClientGetResponse, error) { + var err error + const operationName = "ServiceDiagnosticSettingsClient.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, options) + if err != nil { + return ServiceDiagnosticSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceDiagnosticSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceDiagnosticSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ServiceDiagnosticSettingsClient) getCreateRequest(ctx context.Context, resourceURI string, _ *ServiceDiagnosticSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } + 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", version20160901) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServiceDiagnosticSettingsClient) getHandleResponse(resp *http.Response) (ServiceDiagnosticSettingsClientGetResponse, error) { + result := ServiceDiagnosticSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceDiagnosticSettingsResource); err != nil { + return ServiceDiagnosticSettingsClientGetResponse{}, err + } + return result, nil +} + +// Update - Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. **WARNING**: +// This method will be deprecated in future releases. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - serviceDiagnosticSettingsResource - Parameters supplied to the operation. +// - options - ServiceDiagnosticSettingsClientUpdateOptions contains the optional parameters for the ServiceDiagnosticSettingsClient.Update +// method. +func (client *ServiceDiagnosticSettingsClient) Update(ctx context.Context, resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResourcePatch, options *ServiceDiagnosticSettingsClientUpdateOptions) (ServiceDiagnosticSettingsClientUpdateResponse, error) { + var err error + const operationName = "ServiceDiagnosticSettingsClient.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, resourceURI, serviceDiagnosticSettingsResource, options) + if err != nil { + return ServiceDiagnosticSettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceDiagnosticSettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceDiagnosticSettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ServiceDiagnosticSettingsClient) updateCreateRequest(ctx context.Context, resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResourcePatch, _ *ServiceDiagnosticSettingsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service" + if resourceURI == "" { + return nil, errors.New("parameter resourceURI cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + 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", version20160901) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, serviceDiagnosticSettingsResource); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ServiceDiagnosticSettingsClient) updateHandleResponse(resp *http.Response) (ServiceDiagnosticSettingsClientUpdateResponse, error) { + result := ServiceDiagnosticSettingsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceDiagnosticSettingsResource); err != nil { + return ServiceDiagnosticSettingsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client_example_test.go new file mode 100644 index 000000000000..f75b3f0174b0 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/servicediagnosticsettings_client_example_test.go @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmonitor_test + +import ( + "context" + "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" + "log" +) + +// Generated from example definition: 2016-09-01/createOrUpdateServiceDiagnosticSetting.json +func ExampleServiceDiagnosticSettingsClient_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.NewServiceDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", armmonitor.ServiceDiagnosticSettingsResource{ + Location: to.Ptr(""), + Properties: &armmonitor.ServiceDiagnosticSettings{ + EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/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), + }, + }, + }, + Metrics: []*armmonitor.MetricSettings{ + { + Enabled: to.Ptr(true), + RetentionPolicy: &armmonitor.RetentionPolicy{ + Days: to.Ptr[int32](0), + Enabled: to.Ptr(false), + }, + TimeGrain: to.Ptr("PT1M"), + }, + }, + ServiceBusRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), + 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 = armmonitor.ServiceDiagnosticSettingsClientCreateOrUpdateResponse{ + // ServiceDiagnosticSettingsResource: armmonitor.ServiceDiagnosticSettingsResource{ + // Name: to.Ptr("service"), + // Type: to.Ptr(""), + // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), + // Location: to.Ptr(""), + // Properties: &armmonitor.ServiceDiagnosticSettings{ + // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/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), + // }, + // }, + // }, + // Metrics: []*armmonitor.MetricSettings{ + // { + // Enabled: to.Ptr(true), + // RetentionPolicy: &armmonitor.RetentionPolicy{ + // Days: to.Ptr[int32](0), + // Enabled: to.Ptr(false), + // }, + // TimeGrain: to.Ptr("PT1M"), + // }, + // }, + // ServiceBusRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), + // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), + // WorkspaceID: to.Ptr(""), + // }, + // }, + // } +} + +// Generated from example definition: 2016-09-01/getServiceDiagnosticSetting.json +func ExampleServiceDiagnosticSettingsClient_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.NewServiceDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", 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 = armmonitor.ServiceDiagnosticSettingsClientGetResponse{ + // ServiceDiagnosticSettingsResource: armmonitor.ServiceDiagnosticSettingsResource{ + // Name: to.Ptr("service"), + // Type: to.Ptr(""), + // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), + // Location: to.Ptr(""), + // Properties: &armmonitor.ServiceDiagnosticSettings{ + // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/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), + // }, + // }, + // }, + // Metrics: []*armmonitor.MetricSettings{ + // { + // Enabled: to.Ptr(true), + // RetentionPolicy: &armmonitor.RetentionPolicy{ + // Days: to.Ptr[int32](0), + // Enabled: to.Ptr(false), + // }, + // TimeGrain: to.Ptr("PT1M"), + // }, + // }, + // ServiceBusRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), + // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), + // WorkspaceID: to.Ptr(""), + // }, + // }, + // } +} + +// Generated from example definition: 2016-09-01/updateServiceDiagnosticSetting.json +func ExampleServiceDiagnosticSettingsClient_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.NewServiceDiagnosticSettingsClient().Update(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", armmonitor.ServiceDiagnosticSettingsResourcePatch{ + Properties: &armmonitor.ServiceDiagnosticSettings{ + EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule"), + Logs: []*armmonitor.LogSettings{ + { + Category: to.Ptr("WorkflowRuntime"), + Enabled: to.Ptr(true), + RetentionPolicy: &armmonitor.RetentionPolicy{ + Days: to.Ptr[int32](5), + Enabled: to.Ptr(false), + }, + }, + }, + Metrics: []*armmonitor.MetricSettings{ + { + Enabled: to.Ptr(true), + RetentionPolicy: &armmonitor.RetentionPolicy{ + Days: to.Ptr[int32](3), + Enabled: to.Ptr(false), + }, + TimeGrain: to.Ptr("PT1M"), + }, + }, + ServiceBusRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), + 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 = armmonitor.ServiceDiagnosticSettingsClientUpdateResponse{ + // ServiceDiagnosticSettingsResource: armmonitor.ServiceDiagnosticSettingsResource{ + // Name: to.Ptr("service"), + // Type: to.Ptr(""), + // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), + // Location: to.Ptr(""), + // Properties: &armmonitor.ServiceDiagnosticSettings{ + // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule"), + // Logs: []*armmonitor.LogSettings{ + // { + // Category: to.Ptr("WorkflowRuntime"), + // Enabled: to.Ptr(true), + // RetentionPolicy: &armmonitor.RetentionPolicy{ + // Days: to.Ptr[int32](5), + // Enabled: to.Ptr(false), + // }, + // }, + // }, + // Metrics: []*armmonitor.MetricSettings{ + // { + // Enabled: to.Ptr(true), + // RetentionPolicy: &armmonitor.RetentionPolicy{ + // Days: to.Ptr[int32](3), + // Enabled: to.Ptr(false), + // }, + // TimeGrain: to.Ptr("PT1M"), + // }, + // }, + // ServiceBusRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), + // 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/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go deleted file mode 100644 index c1b97c4287d5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 938808991cd9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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 index 6e7cfe91d4c6..b539a57d4adc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmonitor @@ -12,17 +11,20 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "strings" ) // TenantActivityLogsClient contains the methods for the TenantActivityLogs group. // Don't use this type directly, use NewTenantActivityLogsClient() instead. +// +// Generated from API version 2015-04-01 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. +// - options - Contains optional client configuration. 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 { @@ -34,12 +36,10 @@ func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm 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 +// 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. // - options - TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager // method. func (client *TenantActivityLogsClient) NewListPager(options *TenantActivityLogsClientListOptions) *runtime.Pager[TenantActivityLogsClientListResponse] { @@ -73,14 +73,14 @@ func (client *TenantActivityLogsClient) listCreateRequest(ctx context.Context, o 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() + reqQP.Set("api-version", version20150401) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go index 226bd5889cbb..3b30730f835f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go @@ -1,34 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// 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 +// Generated from example definition: 2015-04-01/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) + 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, - }) + 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'")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,95 +35,99 @@ func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilte _ = 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"), + // page = armmonitor.TenantActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), + // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), // }, - // 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 +// Generated from example definition: 2015-04-01/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) + 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"), - }) + 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 { @@ -138,50 +138,52 @@ func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilte _ = 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"), + // page = armmonitor.TenantActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), // }, - // 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() { +// Generated from example definition: 2015-04-01/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) + 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"), - }) + pager := clientFactory.NewTenantActivityLogsClient().NewListPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -192,50 +194,98 @@ func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithSelec _ = 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"), + // page = armmonitor.TenantActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), + // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), // }, - // 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() { +// Generated from example definition: 2015-04-01/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) + 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, - }) + pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{ + Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -246,77 +296,36 @@ func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithoutFi _ = 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"), + // page = armmonitor.TenantActivityLogsClientListResponse{ + // EventDataCollection: armmonitor.EventDataCollection{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/providers/microsoft.insights/eventtypes/management/values?$skiptoken=opaqueSkipToken"), + // 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.9792776Z"); 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.9936304Z"); return t}()), // }, - // 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/testdata/_metadata.json b/sdk/resourcemanager/monitor/armmonitor/testdata/_metadata.json new file mode 100644 index 000000000000..524702f96713 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/testdata/_metadata.json @@ -0,0 +1,19 @@ +{ + "apiVersions": { + "DataCollectionApi": "2024-03-11", + "PrivateLinkScopesApi": "2023-06-01-preview", + "AutoScaleApi": "2022-10-01", + "ActivityLogsApi": "2015-04-01", + "MetricsApi": "2024-02-01", + "ServiceDiagnosticsSettingsApi": "2016-09-01", + "AlertRulesIncidentsApi": "2016-03-01", + "LogProfilesApi": "2016-03-01", + "ActivityLogAlertsApi": "2023-01-01-preview", + "MetricAlertApi": "2024-03-01-preview", + "ScheduledQueryRuleApi": "2025-01-01-preview", + "MetricBaselinesApi": "2019-03-01", + "ActionGroupsApi": "2024-10-01-preview", + "NetworkSecurityPerimeterApi": "2021-10-01" + }, + "emitterVersion": "0.14.0" +} diff --git a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go deleted file mode 100644 index 68dce5c7db8d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -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/tsp-location.yaml b/sdk/resourcemanager/monitor/armmonitor/tsp-location.yaml new file mode 100644 index 000000000000..ddcf806132eb --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/monitor/resource-manager/Microsoft.Insights/Insights +commit: b26c3c253cff26dd05361e882dbcf1b324f27dfd +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/monitor/armmonitor/version.go b/sdk/resourcemanager/monitor/armmonitor/version.go new file mode 100644 index 000000000000..2fa331dfe745 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/version.go @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. + +package armmonitor + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + moduleVersion = "v1.0.0" +) diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go deleted file mode 100644 index 5213e8589d51..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 9990b110a05b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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"), - // }, - // } -} From 9f726c8571153c48874844bcc2c8561599d13898 Mon Sep 17 00:00:00 2001 From: Chenjie Shi Date: Mon, 25 May 2026 16:17:25 +0800 Subject: [PATCH 2/5] Update CHANGELOG.md --- sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index a915b36451dc..4504943418ce 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0 (2026-05-20) +## 0.12.0 (2026-05-20) ### Breaking Changes - Function `*DataCollectionEndpointsClient.Create` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions)` to `(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, options *DataCollectionEndpointsClientCreateOptions)` From fe038097cd53c8f7d88fd8cb6bd12626cef6db8c Mon Sep 17 00:00:00 2001 From: Chenjie Shi Date: Mon, 25 May 2026 16:18:00 +0800 Subject: [PATCH 3/5] Update version.go --- sdk/resourcemanager/monitor/armmonitor/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/monitor/armmonitor/version.go b/sdk/resourcemanager/monitor/armmonitor/version.go index 2fa331dfe745..783a0caa6fba 100644 --- a/sdk/resourcemanager/monitor/armmonitor/version.go +++ b/sdk/resourcemanager/monitor/armmonitor/version.go @@ -6,5 +6,5 @@ package armmonitor const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - moduleVersion = "v1.0.0" + moduleVersion = "v0.12.0" ) From 6af9ec1ab146380b5d321ed779b855f294deeb7e Mon Sep 17 00:00:00 2001 From: judy Date: Tue, 26 May 2026 15:44:47 +0800 Subject: [PATCH 4/5] update test --- .../monitor/armmonitor/assets.json | 2 +- .../monitor/armmonitor/autoscale_live_test.go | 20 +-- .../datacollectionendpoints_live_test.go | 28 ++-- .../datacollectionrules_live_test.go | 155 +++++++++--------- .../armmonitor/logprofiles_live_test.go | 2 +- .../armmonitor/metricalerts_live_test.go | 7 +- 6 files changed, 97 insertions(+), 117 deletions(-) diff --git a/sdk/resourcemanager/monitor/armmonitor/assets.json b/sdk/resourcemanager/monitor/armmonitor/assets.json index 649b0f872544..6559b1297f9b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/assets.json +++ b/sdk/resourcemanager/monitor/armmonitor/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/monitor/armmonitor", - "Tag": "go/resourcemanager/monitor/armmonitor_fcce349396" + "Tag": "go/resourcemanager/monitor/armmonitor_8259ee6aa6" } diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go index 79688f2ae583..613dc4ecb671 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go @@ -41,7 +41,7 @@ func (testsuite *AutoscaleTestSuite) SetupSuite() { testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) testsuite.autoscaleSettingName, _ = recording.GenerateAlphaNumericID(testsuite.T(), "autoscalesettingna", 24, false) testsuite.adminPassword = recording.GetEnvVariable("ADMIN_PASSWORD", "000000000000") - testsuite.location = recording.GetEnvVariable("LOCATION", "eastus") + testsuite.location = recording.GetEnvVariable("LOCATION", "eastus2") testsuite.resourceGroupName = recording.GetEnvVariable("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") testsuite.subscriptionId = recording.GetEnvVariable("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") @@ -87,7 +87,7 @@ func (testsuite *AutoscaleTestSuite) Prepare() { map[string]interface{}{ "name": "[parameters('virtualNetworksName')]", "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", + "apiVersion": "2024-07-01", "location": "[parameters('location')]", "properties": map[string]interface{}{ "addressSpace": map[string]interface{}{ @@ -99,7 +99,8 @@ func (testsuite *AutoscaleTestSuite) Prepare() { map[string]interface{}{ "name": "vmsssubnet", "properties": map[string]interface{}{ - "addressPrefix": "10.0.0.0/24", + "addressPrefix": "10.0.0.0/24", + "defaultOutboundAccess": false, }, }, }, @@ -277,7 +278,7 @@ func (testsuite *AutoscaleTestSuite) Prepare() { }, }, "sku": map[string]interface{}{ - "name": "Standard_DS1_v2", + "name": "Standard_D2s_v5", "capacity": float64(2), "tier": "Standard", }, @@ -396,14 +397,3 @@ func (testsuite *AutoscaleTestSuite) TestEventcategories() { break } } - -// Microsoft.Insights/operations -func (testsuite *AutoscaleTestSuite) TestOperations() { - var err error - // From step Operations_List - fmt.Println("Call operation: Operations_List") - operationsClient, err := armmonitor.NewOperationsClient(testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = operationsClient.List(testsuite.ctx, nil) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go index 5a92503f0620..e4ca69403f10 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go @@ -60,16 +60,14 @@ func (testsuite *DatacollectionendpointsTestSuite) TestDatacollectionendpoint() fmt.Println("Call operation: DataCollectionEndpoints_Create") dataCollectionEndpointsClient, err := armmonitor.NewDataCollectionEndpointsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) testsuite.Require().NoError(err) - _, err = dataCollectionEndpointsClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, &armmonitor.DataCollectionEndpointsClientCreateOptions{ - Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr(testsuite.location), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, + _, err = dataCollectionEndpointsClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, armmonitor.DataCollectionEndpointResource{ + Location: to.Ptr(testsuite.location), + Properties: &armmonitor.DataCollectionEndpointResourceProperties{ + NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ + PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), }, }, - }) + }, nil) testsuite.Require().NoError(err) // From step DataCollectionEndpoints_ListBySubscription @@ -97,15 +95,13 @@ func (testsuite *DatacollectionendpointsTestSuite) TestDatacollectionendpoint() // From step DataCollectionEndpoints_Update fmt.Println("Call operation: DataCollectionEndpoints_Update") - _, err = dataCollectionEndpointsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, &armmonitor.DataCollectionEndpointsClientUpdateOptions{ - Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, + _, err = dataCollectionEndpointsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, armmonitor.ResourceForUpdate{ + Tags: map[string]*string{ + "tag1": to.Ptr("A"), + "tag2": to.Ptr("B"), + "tag3": to.Ptr("C"), }, - }) + }, nil) testsuite.Require().NoError(err) // From step DataCollectionRuleAssociations_ListByDataCollectionEndpoint diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go index 8ddcc42ebd60..600848e926f2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go @@ -145,7 +145,7 @@ func (testsuite *DatacollectionrulesTestSuite) Prepare() { map[string]interface{}{ "name": "[parameters('managedClustersName')]", "type": "Microsoft.ContainerService/managedClusters", - "apiVersion": "2022-06-02-preview", + "apiVersion": "2024-07-01", "identity": map[string]interface{}{ "type": "SystemAssigned", }, @@ -213,7 +213,6 @@ func (testsuite *DatacollectionrulesTestSuite) Prepare() { "storageProfile": map[string]interface{}{ "diskCSIDriver": map[string]interface{}{ "enabled": true, - "version": "v1", }, "fileCSIDriver": map[string]interface{}{ "enabled": true, @@ -225,8 +224,8 @@ func (testsuite *DatacollectionrulesTestSuite) Prepare() { "workloadAutoScalerProfile": map[string]interface{}{}, }, "sku": map[string]interface{}{ - "name": "Basic", - "tier": "Paid", + "name": "Base", + "tier": "Standard", }, }, }, @@ -259,73 +258,71 @@ func (testsuite *DatacollectionrulesTestSuite) TestDatacollectionrule() { fmt.Println("Call operation: DataCollectionRules_Create") dataCollectionRulesClient, err := armmonitor.NewDataCollectionRulesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) testsuite.Require().NoError(err) - dataCollectionRulesClientCreateResponse, err := dataCollectionRulesClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, &armmonitor.DataCollectionRulesClientCreateOptions{ - Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr(testsuite.location), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ + dataCollectionRulesClientCreateResponse, err := dataCollectionRulesClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, armmonitor.DataCollectionRuleResource{ + Location: to.Ptr(testsuite.location), + Properties: &armmonitor.DataCollectionRuleResourceProperties{ + DataFlows: []*armmonitor.DataFlow{ + { + Destinations: []*string{ + to.Ptr("centralWorkspace")}, + Streams: []*armmonitor.KnownDataFlowStreams{ + to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), + to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog)}, + }}, + DataSources: &armmonitor.DataCollectionRuleDataSources{ + PerformanceCounters: []*armmonitor.PerfCounterDataSource{ { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog)}, + 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)}, + }}, + }, + Destinations: &armmonitor.DataCollectionRuleDestinations{ + LogAnalytics: []*armmonitor.LogAnalyticsDestination{ + { + Name: to.Ptr("centralWorkspace"), + WorkspaceResourceID: to.Ptr(testsuite.workspaceId), }}, - 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)}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr(testsuite.workspaceId), - }}, - }, }, }, - }) + }, nil) testsuite.Require().NoError(err) dataCollectionRuleId = *dataCollectionRulesClientCreateResponse.ID @@ -354,28 +351,24 @@ func (testsuite *DatacollectionrulesTestSuite) TestDatacollectionrule() { // From step DataCollectionRules_Update fmt.Println("Call operation: DataCollectionRules_Update") - _, err = dataCollectionRulesClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, &armmonitor.DataCollectionRulesClientUpdateOptions{ - Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, + _, err = dataCollectionRulesClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, armmonitor.ResourceForUpdate{ + Tags: map[string]*string{ + "tag1": to.Ptr("A"), + "tag2": to.Ptr("B"), + "tag3": to.Ptr("C"), }, - }) + }, nil) testsuite.Require().NoError(err) // From step DataCollectionRuleAssociations_Create fmt.Println("Call operation: DataCollectionRuleAssociations_Create") dataCollectionRuleAssociationsClient, err := armmonitor.NewDataCollectionRuleAssociationsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) testsuite.Require().NoError(err) - _, err = dataCollectionRuleAssociationsClient.Create(testsuite.ctx, testsuite.resourceUri, associationName, &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{ - Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr(dataCollectionRuleId), - }, + _, err = dataCollectionRuleAssociationsClient.Create(testsuite.ctx, testsuite.resourceUri, associationName, armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ + Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ + DataCollectionRuleID: to.Ptr(dataCollectionRuleId), }, - }) + }, nil) testsuite.Require().NoError(err) // From step DataCollectionRuleAssociations_ListByResource diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go index fee4ea9d8570..2501a40cb70d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go @@ -35,7 +35,7 @@ func (testsuite *LogprofilesTestSuite) SetupSuite() { testutil.StartRecording(testsuite.T(), pathToPackage) testsuite.ctx = context.Background() testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.storageAccountName = "monitorsana" + testsuite.storageAccountName, _ = recording.GenerateAlphaNumericID(testsuite.T(), "monitorsana", 18, true) testsuite.location = recording.GetEnvVariable("LOCATION", "eastus") testsuite.resourceGroupName = recording.GetEnvVariable("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") testsuite.subscriptionId = recording.GetEnvVariable("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go index f2dc71b86dad..e576be249291 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go @@ -86,7 +86,7 @@ func (testsuite *MetricalertsTestSuite) Prepare() { map[string]interface{}{ "name": "[parameters('virtualNetworksName')]", "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", + "apiVersion": "2024-07-01", "location": "[parameters('location')]", "properties": map[string]interface{}{ "addressSpace": map[string]interface{}{ @@ -98,7 +98,8 @@ func (testsuite *MetricalertsTestSuite) Prepare() { map[string]interface{}{ "name": "vmsssubnet", "properties": map[string]interface{}{ - "addressPrefix": "10.0.0.0/24", + "addressPrefix": "10.0.0.0/24", + "defaultOutboundAccess": false, }, }, }, @@ -215,7 +216,7 @@ func (testsuite *MetricalertsTestSuite) Prepare() { }, }, "hardwareProfile": map[string]interface{}{ - "vmSize": "Standard_DS1_v2", + "vmSize": "Standard_D2s_v5", }, "networkProfile": map[string]interface{}{ "networkInterfaces": []interface{}{ From e62dc40788ee837b2656dbebb32840be28709dd6 Mon Sep 17 00:00:00 2001 From: judy Date: Tue, 26 May 2026 18:03:14 +0800 Subject: [PATCH 5/5] update assets.json --- sdk/resourcemanager/monitor/armmonitor/assets.json | 2 +- .../monitor/armmonitor/autoscale_live_test.go | 4 ++-- .../monitor/armmonitor/metricalerts_live_test.go | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sdk/resourcemanager/monitor/armmonitor/assets.json b/sdk/resourcemanager/monitor/armmonitor/assets.json index 6559b1297f9b..90e38790c6d8 100644 --- a/sdk/resourcemanager/monitor/armmonitor/assets.json +++ b/sdk/resourcemanager/monitor/armmonitor/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/monitor/armmonitor", - "Tag": "go/resourcemanager/monitor/armmonitor_8259ee6aa6" + "Tag": "go/resourcemanager/monitor/armmonitor_64f06e9eac" } diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go index 613dc4ecb671..0ff022eb1759 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go @@ -41,7 +41,7 @@ func (testsuite *AutoscaleTestSuite) SetupSuite() { testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) testsuite.autoscaleSettingName, _ = recording.GenerateAlphaNumericID(testsuite.T(), "autoscalesettingna", 24, false) testsuite.adminPassword = recording.GetEnvVariable("ADMIN_PASSWORD", "000000000000") - testsuite.location = recording.GetEnvVariable("LOCATION", "eastus2") + testsuite.location = recording.GetEnvVariable("LOCATION", "eastus") testsuite.resourceGroupName = recording.GetEnvVariable("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") testsuite.subscriptionId = recording.GetEnvVariable("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") @@ -278,7 +278,7 @@ func (testsuite *AutoscaleTestSuite) Prepare() { }, }, "sku": map[string]interface{}{ - "name": "Standard_D2s_v5", + "name": "Standard_B2s", "capacity": float64(2), "tier": "Standard", }, diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go index e576be249291..68b8ba0efcd1 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go @@ -216,7 +216,7 @@ func (testsuite *MetricalertsTestSuite) Prepare() { }, }, "hardwareProfile": map[string]interface{}{ - "vmSize": "Standard_D2s_v5", + "vmSize": "Standard_D2s_v3", }, "networkProfile": map[string]interface{}{ "networkInterfaces": []interface{}{ @@ -266,9 +266,6 @@ func (testsuite *MetricalertsTestSuite) Prepare() { }, }, }, - "zones": []interface{}{ - "1", - }, }, }, "variables": map[string]interface{}{},