diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index f216905121dc..c5cac51a9eb5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,90 @@ # Release History +## 0.11.0 (2023-11-21) +### Breaking Changes + +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, PrivateEndpointConnectionAutoGenerated, *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions)` +- Type of `AzureMonitorPrivateLinkScopeProperties.PrivateEndpointConnections` has been changed from `[]*PrivateEndpointConnection` to `[]*PrivateEndpointConnectionAutoGenerated` +- Type of `DefaultErrorResponse.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated` +- Type of `ErrorContract.Error` has been changed from `*ErrorResponse` to `*ErrorResponseAutoGenerated` +- Type of `ErrorResponseCommonV2.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated` +- Type of `MetadataValue.Name` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `Metric.Name` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `Metric.Unit` has been changed from `*Unit` to `*MetricUnit` +- Type of `MetricDefinition.Dimensions` has been changed from `[]*LocalizableString` to `[]*LocalizableStringAutoGenerated` +- Type of `MetricDefinition.Name` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `OperationStatus.Error` has been changed from `*ErrorDetail` to `*ErrorDetailAutoGenerated` +- Type of `PrivateEndpointConnectionListResult.Value` has been changed from `[]*PrivateEndpointConnection` to `[]*PrivateEndpointConnectionAutoGenerated` +- Type of `SubscriptionScopeMetricDefinition.Dimensions` has been changed from `[]*LocalizableString` to `[]*LocalizableStringAutoGenerated` +- Type of `SubscriptionScopeMetricDefinition.Name` has been changed from `*LocalizableString` to `*LocalizableStringAutoGenerated` +- Type of `SubscriptionScopeMetricsRequestBodyParameters.Timespan` has been changed from `*time.Time` to `*string` +- Enum `Unit` has been removed +- Operation `*AzureMonitorWorkspacesClient.Delete` has been changed to LRO, use `*AzureMonitorWorkspacesClient.BeginDelete` instead. +- Operation `*MetricDefinitionsClient.NewListAtSubscriptionScopePager` does not support pagination anymore, use `*MetricDefinitionsClient.ListAtSubscriptionScope` instead. +- Operation `*MetricDefinitionsClient.NewListPager` does not support pagination anymore, use `*MetricDefinitionsClient.List` instead. +- Struct `SubscriptionScopeMetric` has been removed +- Struct `SubscriptionScopeMetricResponse` has been removed +- Field `Code`, `Message` of struct `ErrorResponse` has been removed +- Field `Error` of struct `ErrorResponseAutoGenerated2` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopePostResponse` has been removed +- Field `SubscriptionScopeMetricResponse` of struct `MetricsClientListAtSubscriptionScopeResponse` has been removed +- Field `OperationListResult` of struct `OperationsClientListResponse` has been removed +- Field `OperationListResultAutoGenerated` of struct `OperationsForMonitorClientListResponse` has been removed +- Field `PrivateEndpointConnection` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `PrivateEndpointConnection` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `Location`, `Tags` of struct `Resource` has been removed +- Field `Location`, `Tags` of struct `ResourceAutoGenerated` has been removed +- Field `SystemData` of struct `ResourceAutoGenerated5` has been removed +- Field `SystemData` of struct `TrackedResourceAutoGenerated` has been removed + +### Features Added + +- New function `NewClient(azcore.TokenCredential, *arm.ClientOptions) (*Client, error)` +- New function `*Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel(context.Context, string, string, string, TenantNotificationRequestBody, *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*runtime.Poller[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], error)` +- New function `*Client.GetTestNotificationsAtTenantActionGroupResourceLevel(context.Context, string, string, string, string, *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error)` +- New function `*ClientFactory.NewClient() *Client` +- New struct `ActionDetailAutoGenerated` +- New struct `DimensionProperties` +- New struct `ErrorResponseAdditionalInfoItem` +- New struct `ErrorResponseAutoGenerated3` +- New struct `ErrorResponseAutoGenerated4` +- New struct `LocalizableStringAutoGenerated` +- New struct `LogSpecification` +- New struct `MetricSpecification` +- New struct `OperationProperties` +- New struct `PrivateEndpointAutoGenerated` +- New struct `PrivateEndpointConnectionAutoGenerated` +- New struct `PrivateEndpointConnectionPropertiesAutoGenerated` +- New struct `ResourceAutoGenerated6` +- New struct `ServiceSpecification` +- New struct `TenantNotificationRequestBody` +- New struct `TestNotificationDetailsResponseAutoGenerated` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `AzureMonitorWorkspace` +- New field `PrivateEndpointConnections`, `PublicNetworkAccess` in struct `AzureMonitorWorkspaceResourceProperties` +- New field `Error` in struct `ErrorResponse` +- New field `AdditionalInfo`, `Target` in struct `ErrorResponseAutoGenerated` +- New field `Code`, `Message` in struct `ErrorResponseAutoGenerated2` +- 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 `ActionType`, `IsDataAction`, `Origin` in struct `Operation` +- New field `OperationProperties` in struct `OperationAutoGenerated` +- New field `Description` in struct `OperationDisplay` +- New field `Publisher` in struct `OperationDisplayAutoGenerated` +- New anonymous field `OperationListResultAutoGenerated` in struct `OperationsClientListResponse` +- New anonymous field `OperationListResult` in struct `OperationsForMonitorClientListResponse` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` +- New anonymous field `PrivateEndpointConnectionAutoGenerated` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New anonymous field `PrivateEndpointConnectionAutoGenerated` in struct `PrivateEndpointConnectionsClientGetResponse` +- New field `SystemData` in struct `ResourceAutoGenerated` +- New field `SystemData` in struct `ResourceAutoGenerated2` +- New field `Location`, `Tags` in struct `ResourceAutoGenerated3` +- New field `SystemData` in struct `TrackedResource` + + ## 0.10.2 (2023-10-09) ### Other Changes diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go deleted file mode 100644 index 1c00a65a8bdc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ /dev/null @@ -1,938 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/createOrUpdateActionGroup.json -func ExampleActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().CreateOrUpdate(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.ActionGroup{ - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("Sample armRole"), - RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - UseCommonAlertSchema: to.Ptr(true), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr(""), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - GroupShortName: to.Ptr("sample"), - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // { - // Name: to.Ptr("Sample armRole"), - // RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // { - // Name: to.Ptr("testRunbook"), - // AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - // IsGlobalRunbook: to.Ptr(false), - // RunbookName: to.Ptr("Sample runbook"), - // ServiceURI: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - // }}, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // { - // Name: to.Ptr("Sample azureAppPush"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // }}, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // { - // Name: to.Ptr("Sample azureFunction"), - // FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - // FunctionName: to.Ptr("HttpTriggerCSharp1"), - // HTTPTriggerURL: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // { - // Name: to.Ptr("Sample eventHub"), - // EventHubName: to.Ptr("testEventHub"), - // EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - // SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // { - // Name: to.Ptr("Sample itsm"), - // ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - // Region: to.Ptr("westcentralus"), - // TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - // WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - // }}, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // { - // Name: to.Ptr("Sample logicApp"), - // CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - // ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getActionGroup.json -func ExampleActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Get(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/deleteActionGroup.json -func ExampleActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().Delete(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/patchActionGroup.json -func ExampleActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Update(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupPatchBody{ - Properties: &armmonitor.ActionGroupPatch{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/postTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_BeginCreateNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActionGroupsClient().BeginCreateNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", armmonitor.NotificationRequestBody{ - AlertType: to.Ptr("budget"), - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("ArmRole-Common"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("ArmRole-nonCommon"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(false), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-Name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_GetTestNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().GetTestNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/listActionGroups.json -func ExampleActionGroupsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActionGroupsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ActionGroupList = armmonitor.ActionGroupList{ - // Value: []*armmonitor.ActionGroupResource{ - // { - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SampleActionGroup2"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample2"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/enableReceiver.json -func ExampleActionGroupsClient_EnableReceiver() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().EnableReceiver(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.EnableRequest{ - ReceiverName: to.Ptr("John Doe's mobile"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go deleted file mode 100644 index 200ad713e952..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ /dev/null @@ -1,611 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("Administrative"), - Field: to.Ptr("category"), - }, - { - Equals: to.Ptr("Error"), - Field: to.Ptr("level"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("Category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("Level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithAnyOfCondition", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - AnyOf: []*armmonitor.AlertRuleLeafCondition{ - { - Equals: to.Ptr("Incident"), - Field: to.Ptr("properties.incidentType"), - }, - { - Equals: to.Ptr("Maintenance"), - Field: to.Ptr("properties.incidentType"), - }}, - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithAnyOfCondition"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithAnyOfCondition"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // AnyOf: []*armmonitor.AlertRuleLeafCondition{ - // { - // Equals: to.Ptr("Incident"), - // Field: to.Ptr("properties.incidentType"), - // }, - // { - // Equals: to.Ptr("Maintenance"), - // Field: to.Ptr("properties.incidentType"), - // }}, - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithContainsAny() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithContainsAny", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - ContainsAny: []*string{ - to.Ptr("North Europe"), - to.Ptr("West Europe")}, - Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithContainsAny"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithContainsAny"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // ContainsAny: []*string{ - // to.Ptr("North Europe"), - // to.Ptr("West Europe")}, - // Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json -func ExampleActivityLogAlertsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json -func ExampleActivityLogAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActivityLogAlertsClient().Delete(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json -func ExampleActivityLogAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Update(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.AlertRulePatchObject{ - Properties: &armmonitor.AlertRulePatchProperties{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(false), - // Scopes: []*string{ - // to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json -func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json -func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go deleted file mode 100644 index 33bf7108ca21..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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}()), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go deleted file mode 100644 index f650d5961ee2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json -func ExampleAlertRuleIncidentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRuleIncidentsClient().Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Incident = armmonitor.Incident{ - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.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 -func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRuleIncidentsClient().NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IncidentListResult = armmonitor.IncidentListResult{ - // Value: []*armmonitor.Incident{ - // { - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.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_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go deleted file mode 100644 index c5fb2b416b03..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.0221265Z"); 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.0221265Z"); 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.0221265Z"); 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.0005255Z"); 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.1082596Z"); 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.0005255Z"); 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.1082596Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 250782031b9f..0319f88a6883 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,11 +5,11 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor -module-version: 0.10.2 +module-version: 0.11.0 azcore-version: 1.9.0-beta.1 generate-fakes: true inject-spans: true diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go deleted file mode 100644 index ad28528775d6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ /dev/null @@ -1,1166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListByResourceGroupPager("TestingMetricsScaleSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().CreateOrUpdate(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAutoscaleSettingsClient().Delete(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Get(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Update(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResourcePatch{ - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30: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"), - // }, - // } -} - -// 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: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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go index 684a290f0112..fa1501c24300 100644 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go @@ -43,13 +43,13 @@ func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.To return client, nil } -// Create - Create or update a workspace +// Create - Creates or updates an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - 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 +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive +// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new Azure Monitor 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) { @@ -94,7 +94,7 @@ func (client *AzureMonitorWorkspacesClient) createCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureMonitorWorkspaceProperties); err != nil { @@ -112,37 +112,56 @@ func (client *AzureMonitorWorkspacesClient) createHandleResponse(resp *http.Resp return result, nil } -// Delete - Delete a workspace +// BeginDelete - Deletes an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - 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 +// - azureMonitorWorkspaceName - The name of the Azure Monitor Workspace. The name is case insensitive +// - options - AzureMonitorWorkspacesClientBeginDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.BeginDelete // method. -func (client *AzureMonitorWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error) { +func (client *AzureMonitorWorkspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*runtime.Poller[AzureMonitorWorkspacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, azureMonitorWorkspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureMonitorWorkspacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureMonitorWorkspacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes an Azure Monitor Workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-03 +func (client *AzureMonitorWorkspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "AzureMonitorWorkspacesClient.Delete" + const operationName = "AzureMonitorWorkspacesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientDeleteResponse{}, err + return nil, err } - return AzureMonitorWorkspacesClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (*policy.Request, error) { +func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientBeginDeleteOptions) (*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") @@ -161,18 +180,18 @@ func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Returns the specific Azure Monitor workspace +// Get - Returns the specified Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - 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 +// - 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) { @@ -217,7 +236,7 @@ func (client *AzureMonitorWorkspacesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,9 +251,9 @@ func (client *AzureMonitorWorkspacesClient) getHandleResponse(resp *http.Respons return result, nil } -// NewListByResourceGroupPager - Lists all workspaces in the specified resource group +// NewListByResourceGroupPager - Lists all Azure Monitor Workspaces in the specified resource group // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager // method. @@ -284,7 +303,7 @@ func (client *AzureMonitorWorkspacesClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,9 +318,9 @@ func (client *AzureMonitorWorkspacesClient) listByResourceGroupHandleResponse(re return result, nil } -// NewListBySubscriptionPager - Lists all workspaces in the specified subscription +// NewListBySubscriptionPager - Lists all Azure Monitor Workspaces in the specified subscription // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - options - AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager // method. func (client *AzureMonitorWorkspacesClient) NewListBySubscriptionPager(options *AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse] { @@ -346,7 +365,7 @@ func (client *AzureMonitorWorkspacesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -361,12 +380,12 @@ func (client *AzureMonitorWorkspacesClient) listBySubscriptionHandleResponse(res return result, nil } -// Update - Updates part of a workspace +// Update - Updates part of an Azure Monitor Workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - 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 +// - 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) { @@ -411,7 +430,7 @@ func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.AzureMonitorWorkspaceProperties != 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 8436d5e9dcff..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go +++ /dev/null @@ -1,379 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json -func ExampleAzureMonitorWorkspacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // 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.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), - // }, - // 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.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), - // }, - // 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.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), - // }, - // 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.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), - // }, - // 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.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), - // }, - // 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.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), - // }, - // 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_example_test.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go deleted file mode 100644 index 7eb46f3d4253..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json -func ExampleBaselinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBaselinesClient().NewListPager("subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", &armmonitor.BaselinesClientListOptions{Metricnames: nil, - Metricnamespace: nil, - Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - Interval: to.Ptr("PT1H"), - Aggregation: to.Ptr("average"), - Sensitivities: to.Ptr("Low,Medium"), - Filter: nil, - ResultType: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricBaselinesResponse = armmonitor.MetricBaselinesResponse{ - // Value: []*armmonitor.SingleMetricBaseline{ - // { - // Name: to.Ptr("Percentage CPU"), - // Type: to.Ptr("microsoft.insights/metricBaselines"), - // ID: to.Ptr("/subscriptions/11aeb0ed-456b-4ca0-8df5-b9fbdc63d0d3/resourceGroups/SmartAnalytics-DEV-VM/providers/Microsoft.Compute/virtualMachines/DemoVM1/providers/microsoft.insights/metricBaselines/Percentage CPU"), - // Properties: &armmonitor.MetricBaselinesProperties{ - // Baselines: []*armmonitor.TimeSeriesBaseline{ - // { - // Aggregation: to.Ptr("average"), - // Data: []*armmonitor.SingleBaseline{ - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](90.3453), - // to.Ptr[float64](91.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](30), - // to.Ptr[float64](31.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityLow), - // }, - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](70.3453), - // to.Ptr[float64](71.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](50), - // to.Ptr[float64](51.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityMedium), - // }}, - // Dimensions: []*armmonitor.MetricSingleDimension{ - // }, - // MetadataValues: []*armmonitor.BaselineMetadata{ - // { - // Name: to.Ptr("ErrorType"), - // Value: to.Ptr("TooManyAnomalies"), - // }, - // { - // Name: to.Ptr("SeasonalityFrequency"), - // Value: to.Ptr("288"), - // }}, - // Timestamps: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T11:00:00.000Z"); return t}()), - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T12:00:00.000Z"); return t}())}, - // }}, - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/client.go b/sdk/resourcemanager/monitor/armmonitor/client.go new file mode 100644 index 000000000000..cf57d072afa0 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/client.go @@ -0,0 +1,185 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmonitor + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// Client contains the methods for the MonitorClient group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + internal *arm.Client +} + +// NewClient creates a new instance of Client with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + cl, err := arm.NewClient(moduleName+".Client", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + internal: cl, + } + return client, nil +} + +// BeginCreateNotificationsAtTenantActionGroupResourceLevel - Send test notifications to a set of provided receivers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - notificationRequest - The notification request body which includes the contact details +// - options - ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the +// Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel method. +func (client *Client) BeginCreateNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*runtime.Poller[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createNotificationsAtTenantActionGroupResourceLevel(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateNotificationsAtTenantActionGroupResourceLevel - Send test notifications to a set of provided receivers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *Client) createNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createNotificationsAtTenantActionGroupResourceLevelCreateRequest creates the CreateNotificationsAtTenantActionGroupResourceLevel request. +func (client *Client) createNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest TenantNotificationRequestBody, options *ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/createNotifications" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-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, notificationRequest); err != nil { + return nil, err + } + return req, nil +} + +// GetTestNotificationsAtTenantActionGroupResourceLevel - Get the test notifications by the notification id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - notificationID - The notification id +// - options - ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.GetTestNotificationsAtTenantActionGroupResourceLevel +// method. +func (client *Client) GetTestNotificationsAtTenantActionGroupResourceLevel(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error) { + var err error + const operationName = "Client.GetTestNotificationsAtTenantActionGroupResourceLevel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, notificationID, options) + if err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + resp, err := client.getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse(httpResp) + return resp, err +} + +// getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest creates the GetTestNotificationsAtTenantActionGroupResourceLevel request. +func (client *Client) getTestNotificationsAtTenantActionGroupResourceLevelCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/notificationStatus/{notificationId}" + 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)) + if notificationID == "" { + return nil, errors.New("parameter notificationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{notificationId}", url.PathEscape(notificationID)) + 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-05-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 +} + +// getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse handles the GetTestNotificationsAtTenantActionGroupResourceLevel response. +func (client *Client) getTestNotificationsAtTenantActionGroupResourceLevelHandleResponse(resp *http.Response) (ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse, error) { + result := ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TestNotificationDetailsResponseAutoGenerated); err != nil { + return ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/client_factory.go b/sdk/resourcemanager/monitor/armmonitor/client_factory.go index ad1c5b830b04..9cd1b6b72796 100644 --- a/sdk/resourcemanager/monitor/armmonitor/client_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/client_factory.go @@ -77,6 +77,11 @@ func (c *ClientFactory) NewBaselinesClient() *BaselinesClient { return subClient } +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewDataCollectionEndpointsClient() *DataCollectionEndpointsClient { subClient, _ := NewDataCollectionEndpointsClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 37a49f09ea1a..641b1bd47ba7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -10,7 +10,7 @@ package armmonitor const ( moduleName = "armmonitor" - moduleVersion = "v0.10.2" + moduleVersion = "v0.11.0" ) // AccessMode - Access mode types. @@ -43,7 +43,7 @@ func PossibleActionTypeValues() []ActionType { } } -// AggregationType - the aggregation type of the metric. +// AggregationType - The aggregation type of the metric. type AggregationType string const ( @@ -771,7 +771,7 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// MetricAggregationType - the aggregation type of the metric. +// MetricAggregationType - The aggregation type of the metric. type MetricAggregationType string const ( @@ -860,19 +860,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. @@ -1046,7 +1060,7 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. +// ProvisioningState - The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. type ProvisioningState string const ( @@ -1272,41 +1286,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_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go deleted file mode 100644 index 3fa82586b681..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ /dev/null @@ -1,378 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListByResourceGroup.json -func ExampleDataCollectionEndpointsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListBySubscription.json -func ExampleDataCollectionEndpointsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsGet.json -func ExampleDataCollectionEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Get(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsCreate.json -func ExampleDataCollectionEndpointsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientCreateOptions{Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsUpdate.json -func ExampleDataCollectionEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Update(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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"), - // }, - // } -} - -// 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_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go deleted file mode 100644 index 873160fae2f1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByResource.json -func ExampleDataCollectionRuleAssociationsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByResourcePager("subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // }, - // { - // 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.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), - // }, - // }, - // { - // 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.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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByRule.json -func ExampleDataCollectionRuleAssociationsClient_NewListByRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByRulePager("myResourceGroup", "myCollectionRule", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json -func ExampleDataCollectionRuleAssociationsClient_NewListByDataCollectionEndpointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByDataCollectionEndpointPager("myResourceGroup", "myDataCollectionEndpointName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsGet.json -func ExampleDataCollectionRuleAssociationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Get(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsCreate.json -func ExampleDataCollectionRuleAssociationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsDelete.json -func ExampleDataCollectionRuleAssociationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRuleAssociationsClient().Delete(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go deleted file mode 100644 index 2cabfb2179a4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ /dev/null @@ -1,864 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListByResourceGroup.json -func ExampleDataCollectionRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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.DataCollectionRuleResourceSystemData{ - // 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: 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.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.DataCollectionRuleResourceSystemData{ - // 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: 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.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesCreate.json -func ExampleDataCollectionRulesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientCreateOptions{Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ - { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - }}, - DataSources: &armmonitor.DataCollectionRuleDataSources{ - PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - { - Name: to.Ptr("cloudTeamCoreCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Processor(_Total)\\% Processor Time"), - to.Ptr("\\Memory\\Committed Bytes"), - to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - SamplingFrequencyInSeconds: to.Ptr[int32](15), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }, - { - Name: to.Ptr("appTeamExtraCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, - SamplingFrequencyInSeconds: to.Ptr[int32](30), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, - Syslog: []*armmonitor.SyslogDataSource{ - { - Name: to.Ptr("cronSyslog"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }, - { - Name: to.Ptr("syslogBase"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, - WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - { - Name: to.Ptr("cloudSecurityTeamEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("Security!")}, - }, - { - Name: to.Ptr("appTeam1AppEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - }}, - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesUpdate.json -func ExampleDataCollectionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Update(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesDelete.json -func ExampleDataCollectionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRulesClient().Delete(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go deleted file mode 100644 index 6bfb57627706..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,404 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - CategoryGroup: to.Ptr("allLogs"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - Category: to.Ptr("WorkflowRuntime"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticSettingsClient().Delete(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("microsoft.logic/workflows"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go deleted file mode 100644 index 4b667e1fa043..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsCategoryClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsCategoryClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "WorkflowRuntime", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnosticSettingsCategoryResource = armmonitor.DiagnosticSettingsCategoryResource{ - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json -func ExampleDiagnosticSettingsCategoryClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsCategoryClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiagnosticSettingsCategoryResourceCollection = armmonitor.DiagnosticSettingsCategoryResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsCategoryResource{ - // { - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // }, - // { - // Name: to.Ptr("WorkflowMetric"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowMetric"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryType: to.Ptr(armmonitor.CategoryTypeMetrics), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go deleted file mode 100644 index 765f747c362c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json -func ExampleEventCategoriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventCategoriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventCategoryCollection = armmonitor.EventCategoryCollection{ - // Value: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("category1"), - // Value: to.Ptr("category1"), - // }, - // { - // LocalizedValue: to.Ptr("category2"), - // Value: to.Ptr("category2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go index 3baf3ef7d702..35770e96f257 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go @@ -29,9 +29,9 @@ type AzureMonitorWorkspacesServer struct { // 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) + // BeginDelete is the fake for method AzureMonitorWorkspacesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AzureMonitorWorkspacesClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -56,6 +56,7 @@ type AzureMonitorWorkspacesServer struct { func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) *AzureMonitorWorkspacesServerTransport { return &AzureMonitorWorkspacesServerTransport{ srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]](), } @@ -65,6 +66,7 @@ func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) // Don't use this type directly, use NewAzureMonitorWorkspacesServerTransport instead. type AzureMonitorWorkspacesServerTransport struct { srv *AzureMonitorWorkspacesServer + beginDelete *tracker[azfake.PollerResponder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]] } @@ -83,8 +85,8 @@ func (a *AzureMonitorWorkspacesServerTransport) Do(req *http.Request) (*http.Res switch method { case "AzureMonitorWorkspacesClient.Create": resp, err = a.dispatchCreate(req) - case "AzureMonitorWorkspacesClient.Delete": - resp, err = a.dispatchDelete(req) + case "AzureMonitorWorkspacesClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) case "AzureMonitorWorkspacesClient.Get": resp, err = a.dispatchGet(req) case "AzureMonitorWorkspacesClient.NewListByResourceGroupPager": @@ -141,36 +143,47 @@ func (a *AzureMonitorWorkspacesServerTransport) dispatchCreate(req *http.Request 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")} +func (a *AzureMonitorWorkspacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete 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) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + azureMonitorWorkspaceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, azureMonitorWorkspaceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) } - azureMonitorWorkspaceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) + + resp, err := server.PollerResponderNext(beginDelete, req) if err != nil { return nil, err } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameUnescaped, azureMonitorWorkspaceNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } - 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 + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) } + return resp, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go index d3d10d95597a..41dd72a5adb8 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go @@ -9,6 +9,7 @@ package fake import ( + "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" @@ -22,32 +23,26 @@ import ( // MetricDefinitionsServer is a fake server for instances of the armmonitor.MetricDefinitionsClient type. type MetricDefinitionsServer struct { - // NewListPager is the fake for method MetricDefinitionsClient.NewListPager + // List is the fake for method MetricDefinitionsClient.List // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.MetricDefinitionsClientListOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]) + List func(ctx context.Context, resourceURI string, options *armmonitor.MetricDefinitionsClientListOptions) (resp azfake.Responder[armmonitor.MetricDefinitionsClientListResponse], errResp azfake.ErrorResponder) - // NewListAtSubscriptionScopePager is the fake for method MetricDefinitionsClient.NewListAtSubscriptionScopePager + // ListAtSubscriptionScope is the fake for method MetricDefinitionsClient.ListAtSubscriptionScope // HTTP status codes to indicate success: http.StatusOK - NewListAtSubscriptionScopePager func(region string, options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]) + ListAtSubscriptionScope func(ctx context.Context, region string, options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions) (resp azfake.Responder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse], errResp azfake.ErrorResponder) } // NewMetricDefinitionsServerTransport creates a new instance of MetricDefinitionsServerTransport with the provided implementation. // The returned MetricDefinitionsServerTransport instance is connected to an instance of armmonitor.MetricDefinitionsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewMetricDefinitionsServerTransport(srv *MetricDefinitionsServer) *MetricDefinitionsServerTransport { - return &MetricDefinitionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]](), - newListAtSubscriptionScopePager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]](), - } + return &MetricDefinitionsServerTransport{srv: srv} } // MetricDefinitionsServerTransport connects instances of armmonitor.MetricDefinitionsClient to instances of MetricDefinitionsServer. // Don't use this type directly, use NewMetricDefinitionsServerTransport instead. type MetricDefinitionsServerTransport struct { - srv *MetricDefinitionsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]] - newListAtSubscriptionScopePager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]] + srv *MetricDefinitionsServer } // Do implements the policy.Transporter interface for MetricDefinitionsServerTransport. @@ -62,10 +57,10 @@ func (m *MetricDefinitionsServerTransport) Do(req *http.Request) (*http.Response var err error switch method { - case "MetricDefinitionsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "MetricDefinitionsClient.NewListAtSubscriptionScopePager": - resp, err = m.dispatchNewListAtSubscriptionScopePager(req) + case "MetricDefinitionsClient.List": + resp, err = m.dispatchList(req) + case "MetricDefinitionsClient.ListAtSubscriptionScope": + resp, err = m.dispatchListAtSubscriptionScope(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -77,94 +72,84 @@ func (m *MetricDefinitionsServerTransport) Do(req *http.Request) (*http.Response return resp, nil } -func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := m.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListPager(resourceURIUnescaped, options) - newListPager = &resp - m.newListPager.add(req, newListPager) +func (m *MetricDefinitionsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if m.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/metricDefinitions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceURIUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err } - resp, err := server.PagerResponderNext(newListPager, req) + metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + metricnamespaceParam := getOptional(metricnamespaceUnescaped) + var options *armmonitor.MetricDefinitionsClientListOptions + if metricnamespaceParam != nil { + options = &armmonitor.MetricDefinitionsClientListOptions{ + Metricnamespace: metricnamespaceParam, + } + } + respr, errRespr := m.srv.List(req.Context(), resourceURIUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr } - if !server.PagerResponderMore(newListPager) { - m.newListPager.remove(req) + 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).MetricDefinitionCollection, req) + if err != nil { + return nil, err } return resp, nil } -func (m *MetricDefinitionsServerTransport) dispatchNewListAtSubscriptionScopePager(req *http.Request) (*http.Response, error) { - if m.srv.NewListAtSubscriptionScopePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAtSubscriptionScopePager not implemented")} - } - newListAtSubscriptionScopePager := m.newListAtSubscriptionScopePager.get(req) - if newListAtSubscriptionScopePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regionUnescaped, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListAtSubscriptionScopePager(regionUnescaped, options) - newListAtSubscriptionScopePager = &resp - m.newListAtSubscriptionScopePager.add(req, newListAtSubscriptionScopePager) +func (m *MetricDefinitionsServerTransport) dispatchListAtSubscriptionScope(req *http.Request) (*http.Response, error) { + if m.srv.ListAtSubscriptionScope == nil { + return nil, &nonRetriableError{errors.New("fake for method ListAtSubscriptionScope not implemented")} } - resp, err := server.PagerResponderNext(newListAtSubscriptionScopePager, req) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/metricDefinitions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + regionUnescaped, err := url.QueryUnescape(qp.Get("region")) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListAtSubscriptionScopePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) + if err != nil { + return nil, err } - if !server.PagerResponderMore(newListAtSubscriptionScopePager) { - m.newListAtSubscriptionScopePager.remove(req) + metricnamespaceParam := getOptional(metricnamespaceUnescaped) + var options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions + if metricnamespaceParam != nil { + options = &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{ + Metricnamespace: metricnamespaceParam, + } + } + respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionUnescaped, 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).SubscriptionScopeMetricDefinitionCollection, req) + if err != nil { + return nil, err } return resp, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go index 7cc9e4c20e62..02bf47b4e80e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go @@ -165,8 +165,13 @@ func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) 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, @@ -179,6 +184,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(), resourceURIUnescaped, options) @@ -281,8 +287,13 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) 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, @@ -295,6 +306,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, } } respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionUnescaped, options) @@ -305,7 +317,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Reque if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } @@ -401,8 +413,13 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R if err != nil { return nil, err } + rollupbyUnescaped, err := url.QueryUnescape(qp.Get("rollupby")) + if err != nil { + return nil, err + } + rollupbyParam := getOptional(rollupbyUnescaped) 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, @@ -415,6 +432,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R Metricnamespace: metricnamespaceParam, AutoAdjustTimegrain: autoAdjustTimegrainParam, ValidateDimensions: validateDimensionsParam, + Rollupby: rollupbyParam, Body: &body, } } @@ -426,7 +444,7 @@ func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.R if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go index 3f4ae743691f..8e23e3243124 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go @@ -76,7 +76,7 @@ func (o *OperationsServerTransport) dispatchList(req *http.Request) (*http.Respo 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) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResultAutoGenerated, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go index 91857163ee28..ae2b69346707 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go @@ -25,7 +25,7 @@ import ( type PrivateEndpointConnectionsServer struct { // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnection, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnectionAutoGenerated, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -102,7 +102,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnection](req) + body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnectionAutoGenerated](req) if err != nil { return nil, err } @@ -220,7 +220,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionAutoGenerated, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/server.go b/sdk/resourcemanager/monitor/armmonitor/fake/server.go new file mode 100644 index 000000000000..7c48534b6af6 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/fake/server.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "net/http" + "net/url" + "regexp" +) + +// Server is a fake server for instances of the armmonitor.Client type. +type Server struct { + // BeginCreateNotificationsAtTenantActionGroupResourceLevel is the fake for method Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateNotificationsAtTenantActionGroupResourceLevel func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationRequest armmonitor.TenantNotificationRequestBody, options *armmonitor.ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions) (resp azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) + + // GetTestNotificationsAtTenantActionGroupResourceLevel is the fake for method Client.GetTestNotificationsAtTenantActionGroupResourceLevel + // HTTP status codes to indicate success: http.StatusOK + GetTestNotificationsAtTenantActionGroupResourceLevel func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, notificationID string, options *armmonitor.ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions) (resp azfake.Responder[armmonitor.ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse], errResp azfake.ErrorResponder) +} + +// NewServerTransport creates a new instance of ServerTransport with the provided implementation. +// The returned ServerTransport instance is connected to an instance of armmonitor.Client via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerTransport(srv *Server) *ServerTransport { + return &ServerTransport{ + srv: srv, + beginCreateNotificationsAtTenantActionGroupResourceLevel: newTracker[azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]](), + } +} + +// ServerTransport connects instances of armmonitor.Client to instances of Server. +// Don't use this type directly, use NewServerTransport instead. +type ServerTransport struct { + srv *Server + beginCreateNotificationsAtTenantActionGroupResourceLevel *tracker[azfake.PollerResponder[armmonitor.ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse]] +} + +// Do implements the policy.Transporter interface for ServerTransport. +func (s *ServerTransport) 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 "Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel": + resp, err = s.dispatchBeginCreateNotificationsAtTenantActionGroupResourceLevel(req) + case "Client.GetTestNotificationsAtTenantActionGroupResourceLevel": + resp, err = s.dispatchGetTestNotificationsAtTenantActionGroupResourceLevel(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerTransport) dispatchBeginCreateNotificationsAtTenantActionGroupResourceLevel(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateNotificationsAtTenantActionGroupResourceLevel == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateNotificationsAtTenantActionGroupResourceLevel not implemented")} + } + beginCreateNotificationsAtTenantActionGroupResourceLevel := s.beginCreateNotificationsAtTenantActionGroupResourceLevel.get(req) + if beginCreateNotificationsAtTenantActionGroupResourceLevel == nil { + const regexStr = `/providers/Microsoft.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createNotifications` + 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.TenantNotificationRequestBody](req) + if err != nil { + return nil, err + } + managementGroupIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) + if err != nil { + return nil, err + } + tenantActionGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateNotificationsAtTenantActionGroupResourceLevel(req.Context(), managementGroupIDUnescaped, tenantActionGroupNameUnescaped, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateNotificationsAtTenantActionGroupResourceLevel = &respr + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.add(req, beginCreateNotificationsAtTenantActionGroupResourceLevel) + } + + resp, err := server.PollerResponderNext(beginCreateNotificationsAtTenantActionGroupResourceLevel, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateNotificationsAtTenantActionGroupResourceLevel) { + s.beginCreateNotificationsAtTenantActionGroupResourceLevel.remove(req) + } + + return resp, nil +} + +func (s *ServerTransport) dispatchGetTestNotificationsAtTenantActionGroupResourceLevel(req *http.Request) (*http.Response, error) { + if s.srv.GetTestNotificationsAtTenantActionGroupResourceLevel == nil { + return nil, &nonRetriableError{errors.New("fake for method GetTestNotificationsAtTenantActionGroupResourceLevel not implemented")} + } + const regexStr = `/providers/Microsoft.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Insights/tenantActionGroups/(?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) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + managementGroupIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) + if err != nil { + return nil, err + } + tenantActionGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) + if err != nil { + return nil, err + } + notificationIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("notificationId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetTestNotificationsAtTenantActionGroupResourceLevel(req.Context(), managementGroupIDUnescaped, tenantActionGroupNameUnescaped, getHeaderValue(req.Header, "x-ms-client-tenant-id"), notificationIDUnescaped, 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).TestNotificationDetailsResponseAutoGenerated, 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 f4932dd4e830..c42dbd3e7c97 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go deleted file mode 100644 index 66b0efcdbaae..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ /dev/null @@ -1,262 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json -func ExampleLogProfilesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json -func ExampleLogProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Get(ctx, "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json -func ExampleLogProfilesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResource{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json -func ExampleLogProfilesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Update(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResourcePatch{ - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json -func ExampleLogProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogProfilesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogProfileCollection = armmonitor.LogProfileCollection{ - // Value: []*armmonitor.LogProfileResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // }, - // { - // Name: to.Ptr("default2"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](15), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go deleted file mode 100644 index 6d1dd5eb5028..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ /dev/null @@ -1,1477 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json -func ExampleMetricAlertsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricAlertsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricAlertResourceCollection = armmonitor.MetricAlertResourceCollection{ - // Value: []*armmonitor.MetricAlertResource{ - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Med cpu alert"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("Medium_CPU_50"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](50.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json -func ExampleMetricAlertsClient_Get_getAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "rg-example", "webtest-name-example", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\""), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t }()), - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t}()), - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "rg-example", "webtest-name-example", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{ - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": to.Ptr("Resource"), - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": to.Ptr("Resource"), - }, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("Automatically created alert rule for availability test \"component-example\" a"), - Actions: []*armmonitor.MetricAlertAction{}, - Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"), - FailedLocationCount: to.Ptr[float32](2), - WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example")}, - Severity: to.Ptr[int32](4), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\" a"), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultipleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDimensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleDimensions", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("Metric1"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{ - { - Name: to.Ptr("ActivityName"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("*")}, - }, - { - Name: to.Ptr("StatusCode"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("200")}, - }}, - MetricName: to.Ptr("Availability"), - MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](55), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1H"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("P1D"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("Metric1"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // { - // Name: to.Ptr("ActivityName"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("*")}, - // }, - // { - // Name: to.Ptr("StatusCode"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("200")}, - // }}, - // MetricName: to.Ptr("Availability"), - // MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](55), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1H"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.KeyVault/vaults"), - // WindowSize: to.Ptr("P1D"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json -func ExampleMetricAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Update(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResourcePatch{ - Properties: &armmonitor.MetricAlertPropertiesPatch{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - Tags: map[string]*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json -func ExampleMetricAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetricAlertsClient().Delete(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go deleted file mode 100644 index 60a3fb38b8c5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json -func ExampleMetricAlertsStatusClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().List(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.6293237Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json -func ExampleMetricAlertsStatusClient_ListByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().ListByName(ctx, "EastUs", "custom1", "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.6293237Z"); return t}()), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go index 6e21bb1819ab..e450d92373c5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -43,34 +43,32 @@ func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCr return client, nil } -// NewListPager - Lists the metric definitions for the resource. +// List - Lists the metric definitions for the resource. +// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2023-10-01 // - resourceURI - The identifier of the resource. -// - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager -// method. -func (client *MetricDefinitionsClient) NewListPager(resourceURI string, options *MetricDefinitionsClientListOptions) *runtime.Pager[MetricDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListResponse]{ - More: func(page MetricDefinitionsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListResponse) (MetricDefinitionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) +// - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.List method. +func (client *MetricDefinitionsClient) List(ctx context.Context, resourceURI string, options *MetricDefinitionsClientListOptions) (MetricDefinitionsClientListResponse, error) { + var err error + const operationName = "MetricDefinitionsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceURI, options) + if err != nil { + return MetricDefinitionsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetricDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MetricDefinitionsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -82,7 +80,7 @@ func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2023-10-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } @@ -100,34 +98,33 @@ func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) ( return result, nil } -// NewListAtSubscriptionScopePager - Lists the metric definitions for the subscription. +// ListAtSubscriptionScope - Lists the metric definitions for the subscription. +// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2023-10-01 // - region - The region where the metrics you want reside. -// - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager +// - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.ListAtSubscriptionScope // method. -func (client *MetricDefinitionsClient) NewListAtSubscriptionScopePager(region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) *runtime.Pager[MetricDefinitionsClientListAtSubscriptionScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListAtSubscriptionScopeResponse]{ - More: func(page MetricDefinitionsClientListAtSubscriptionScopeResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListAtSubscriptionScopeResponse) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListAtSubscriptionScopePager") - req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listAtSubscriptionScopeHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) +func (client *MetricDefinitionsClient) ListAtSubscriptionScope(ctx context.Context, region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { + var err error + const operationName = "MetricDefinitionsClient.ListAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) + if err != nil { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + resp, err := client.listAtSubscriptionScopeHandleResponse(httpResp) + return resp, err } // listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. @@ -142,7 +139,7 @@ func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2023-10-01") reqQP.Set("region", region) if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go deleted file mode 100644 index 94630917f42d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ /dev/null @@ -1,7245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListAtSubscriptionScopePager("westus2", &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{Metricnamespace: to.Ptr("microsoft.compute/virtualmachines")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionScopeMetricDefinitionCollection = armmonitor.SubscriptionScopeMetricDefinitionCollection{ - // Value: []*armmonitor.SubscriptionScopeMetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Percentage CPU"), - // Value: to.Ptr("Percentage CPU"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The percentage of allocated compute units that are currently in use by the Virtual Machine(s)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Percentage CPU"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Billable (Deprecated)"), - // Value: to.Ptr("Network In"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Billable (Deprecated)"), - // Value: to.Ptr("Network Out"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Bytes"), - // Value: to.Ptr("Disk Read Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes read from disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Bytes"), - // Value: to.Ptr("Disk Write Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes written to disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Operations/Sec"), - // Value: to.Ptr("Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Read IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Operations/Sec"), - // Value: to.Ptr("Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Write IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Remaining"), - // Value: to.Ptr("CPU Credits Remaining"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits available to burst. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Remaining"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Consumed"), - // Value: to.Ptr("CPU Credits Consumed"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits consumed by the Virtual Machine. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Consumed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Bytes/Sec"), - // Value: to.Ptr("Data Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Operations/Sec"), - // Value: to.Ptr("Data Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Operations/Sec"), - // Value: to.Ptr("Data Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Queue Depth"), - // Value: to.Ptr("Data Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Data Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk IOPS Consumed Percentage"), - // Value: to.Ptr("Data Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target Bandwidth"), - // Value: to.Ptr("Data Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target IOPS"), - // Value: to.Ptr("Data Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst Bandwidth"), - // Value: to.Ptr("Data Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Bytes/Sec"), - // Value: to.Ptr("OS Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Bytes/Sec"), - // Value: to.Ptr("OS Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Operations/Sec"), - // Value: to.Ptr("OS Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Operations/Sec"), - // Value: to.Ptr("OS Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Queue Depth"), - // Value: to.Ptr("OS Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("OS Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk IOPS Consumed Percentage"), - // Value: to.Ptr("OS Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target Bandwidth"), - // Value: to.Ptr("OS Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target IOPS"), - // Value: to.Ptr("OS Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst Bandwidth"), - // Value: to.Ptr("OS Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst IOPS"), - // Value: to.Ptr("OS Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows"), - // Value: to.Ptr("Inbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Inbound Flows are number of current flows in the inbound direction (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows"), - // Value: to.Ptr("Outbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Outbound Flows are number of current flows in the outbound direction (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Inbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of inbound flows (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Outbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of outbound flows (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Hit"), - // Value: to.Ptr("Premium Data Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Miss"), - // Value: to.Ptr("Premium Data Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Hit"), - // Value: to.Ptr("Premium OS Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Miss"), - // Value: to.Ptr("Premium OS Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Cached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Total"), - // Value: to.Ptr("Network In Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Total"), - // Value: to.Ptr("Network Out Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsApplicationInsights.json -func ExampleMetricDefinitionsClient_NewListPager_getApplicationInsightsMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.insights/components")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability"), - // Value: to.Ptr("availabilityResults/availabilityPercentage"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }}, - // DisplayDescription: to.Ptr("Percentage of successfully completed availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/availabilityPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability tests"), - // Value: to.Ptr("availabilityResults/count"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Count of availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability test duration"), - // Value: to.Ptr("availabilityResults/duration"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Availability test duration"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page load network connect time"), - // Value: to.Ptr("browserTimings/networkDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between user request and network connection. Includes DNS lookup and transport connection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/networkDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client processing time"), - // Value: to.Ptr("browserTimings/processingDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between receiving the last byte of a document until the DOM is loaded. Async requests may still be processing."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/processingDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Receiving response time"), - // Value: to.Ptr("browserTimings/receiveDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between the first and last bytes, or until disconnection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/receiveDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Send request time"), - // Value: to.Ptr("browserTimings/sendDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between network connection and receiving the first byte."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/sendDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser page load time"), - // Value: to.Ptr("browserTimings/totalDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time from user request until DOM, stylesheets, scripts and images are loaded."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/totalDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency calls"), - // Value: to.Ptr("dependencies/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency duration"), - // Value: to.Ptr("dependencies/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Duration of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency call failures"), - // Value: to.Ptr("dependencies/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of failed dependency calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page views"), - // Value: to.Ptr("pageViews/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of page views."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page view load time"), - // Value: to.Ptr("pageViews/duration"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Page view load time"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request execution time"), - // Value: to.Ptr("performanceCounters/requestExecutionTime"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Execution time of the most recent request."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestExecutionTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP requests in application queue"), - // Value: to.Ptr("performanceCounters/requestsInQueue"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Length of the application request queue."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsInQueue"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request rate"), - // Value: to.Ptr("performanceCounters/requestsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Rate of all requests to the application per second from ASP.NET."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exception rate"), - // Value: to.Ptr("performanceCounters/exceptionsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of handled and unhandled exceptions reported to windows, including .NET exceptions and unmanaged exceptions that are converted into .NET exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/exceptionsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process IO rate"), - // Value: to.Ptr("performanceCounters/processIOBytesPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Total bytes per second read and written to files, network and devices."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processIOBytesPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process CPU"), - // Value: to.Ptr("performanceCounters/processCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of elapsed time that all process threads used the processor to execute instructions. This can vary between 0 to 100. This metric indicates the performance of w3wp process alone."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Processor time"), - // Value: to.Ptr("performanceCounters/processorCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of time that the processor spends in non-idle threads."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processorCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Available memory"), - // Value: to.Ptr("performanceCounters/memoryAvailableBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Physical memory immediately available for allocation to a process or for system use."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/memoryAvailableBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process private bytes"), - // Value: to.Ptr("performanceCounters/processPrivateBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Memory exclusively assigned to the monitored application's processes."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processPrivateBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server response time"), - // Value: to.Ptr("requests/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Time between receiving an HTTP request and finishing sending the response."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server requests"), - // Value: to.Ptr("requests/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests completed."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Failed requests"), - // Value: to.Ptr("requests/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests marked as failed. In most cases these are requests with a response code >= 400 and not equal to 401."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server request rate"), - // Value: to.Ptr("requests/rate"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Rate of server requests per second"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exceptions"), - // Value: to.Ptr("exceptions/count"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Device type"), - // Value: to.Ptr("client/type"), - // }}, - // DisplayDescription: to.Ptr("Combined count of all uncaught exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser exceptions"), - // Value: to.Ptr("exceptions/browser"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the browser."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/browser"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server exceptions"), - // Value: to.Ptr("exceptions/server"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the server application."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/server"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Traces"), - // Value: to.Ptr("traces/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Severity level"), - // Value: to.Ptr("trace/severityLevel"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Trace document count"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/traces/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("Microsoft.Web/sites")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Time"), - // Value: to.Ptr("CpuTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/CpuTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Requests"), - // Value: to.Ptr("Requests"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Requests"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data In"), - // Value: to.Ptr("BytesReceived"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesReceived"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Out"), - // Value: to.Ptr("BytesSent"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesSent"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 101"), - // Value: to.Ptr("Http101"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http101"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 2xx"), - // Value: to.Ptr("Http2xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http2xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 3xx"), - // Value: to.Ptr("Http3xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http3xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 401"), - // Value: to.Ptr("Http401"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http401"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 403"), - // Value: to.Ptr("Http403"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http403"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 404"), - // Value: to.Ptr("Http404"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http404"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 406"), - // Value: to.Ptr("Http406"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http406"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 4xx"), - // Value: to.Ptr("Http4xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http4xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http Server Errors"), - // Value: to.Ptr("Http5xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http5xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Memory working set"), - // Value: to.Ptr("MemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/MemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average memory working set"), - // Value: to.Ptr("AverageMemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageMemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Response Time"), - // Value: to.Ptr("AverageResponseTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageResponseTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsMetricClass.json -func ExampleMetricDefinitionsClient_NewListPager_getStorageCacheMetricDefinitionsWithMetricClass() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.storagecache/caches")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total Client IOPS"), - // Value: to.Ptr("ClientIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations processed by the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Client Latency"), - // Value: to.Ptr("ClientLatency"), - // }, - // DisplayDescription: to.Ptr("Average latency of client file operations to the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassLatency), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Read IOPS"), - // Value: to.Ptr("ClientReadIOPS"), - // }, - // DisplayDescription: to.Ptr("Client read operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Read Throughput"), - // Value: to.Ptr("ClientReadThroughput"), - // }, - // DisplayDescription: to.Ptr("Client read data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Write IOPS"), - // Value: to.Ptr("ClientWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("Client write operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Write Throughput"), - // Value: to.Ptr("ClientWriteThroughput"), - // }, - // DisplayDescription: to.Ptr("Client write data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Read IOPS"), - // Value: to.Ptr("ClientMetadataReadIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data reads, that do not modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Write IOPS"), - // Value: to.Ptr("ClientMetadataWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data writes, that modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Lock IOPS"), - // Value: to.Ptr("ClientLockIOPS"), - // }, - // DisplayDescription: to.Ptr("Client file locking operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLockIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Storage Target Health"), - // Value: to.Ptr("StorageTargetHealth"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and Storage Targets."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetHealth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassErrors), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Uptime"), - // Value: to.Ptr("Uptime"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and monitoring system."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/Uptime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassAvailability), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total StorageTarget IOPS"), - // Value: to.Ptr("StorageTargetIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of all file operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Write IOPS"), - // Value: to.Ptr("StorageTargetWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of the file write operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Asynchronous Write Throughput"), - // Value: to.Ptr("StorageTargetAsyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache asynchronously writes data to a particular StorageTarget. These are opportunistic writes that do not cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetAsyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Synchronous Write Throughput"), - // Value: to.Ptr("StorageTargetSyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache synchronously writes data to a particular StorageTarget. These are writes that do cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetSyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Write Throughput"), - // Value: to.Ptr("StorageTargetTotalWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache writes data to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Latency"), - // Value: to.Ptr("StorageTargetLatency"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The average round trip latency of all the file operations the Cache sends to a partricular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Read IOPS"), - // Value: to.Ptr("StorageTargetMetadataReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do not modify persistent state, and excluding the read operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Write IOPS"), - // Value: to.Ptr("StorageTargetMetadataWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do modify persistent state and excluding the write operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read IOPS"), - // Value: to.Ptr("StorageTargetReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file read operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read Ahead Throughput"), - // Value: to.Ptr("StorageTargetReadAheadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache opportunisticly reads data from the StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadAheadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Fill Throughput"), - // Value: to.Ptr("StorageTargetFillThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache reads data from the StorageTarget to handle a cache miss."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetFillThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Read Throughput"), - // Value: to.Ptr("StorageTargetTotalReadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache reads data from a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go deleted file mode 100644 index 0ef141700996..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json -func ExampleMetricNamespacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{ - // Value: []*armmonitor.MetricNamespace{ - // { - // Name: to.Ptr("Azure.ApplicationInsights"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationCustom), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"), - // }, - // }, - // { - // Name: to.Ptr("microsoft.insights-components"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("microsoft.insights/components"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go index db1035d2f9f8..59b89c4713e6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -47,7 +47,7 @@ func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, // List - Lists the metric values for a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2023-10-01 // - resourceURI - The identifier of the resource. // - options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. func (client *MetricsClient) List(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (MetricsClientListResponse, error) { @@ -105,7 +105,7 @@ func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI if options != nil && options.ResultType != nil { reqQP.Set("resultType", string(*options.ResultType)) } - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2023-10-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } @@ -115,6 +115,9 @@ func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI if options != nil && options.ValidateDimensions != nil { reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) } + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -132,7 +135,7 @@ func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsCli // ListAtSubscriptionScope - Lists the metric data for a subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2023-10-01 // - region - The region where the metrics you want reside. // - options - MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope // method. @@ -170,7 +173,7 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2023-10-01") reqQP.Set("region", region) if options != nil && options.Timespan != nil { reqQP.Set("timespan", *options.Timespan) @@ -205,6 +208,9 @@ func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Co if options != nil && options.ValidateDimensions != nil { reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) } + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +219,7 @@ 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 @@ -223,7 +229,7 @@ func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Re // or the body. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2023-10-01 // - region - The region where the metrics you want reside. // - options - MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost // method. @@ -261,7 +267,7 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2023-10-01") reqQP.Set("region", region) if options != nil && options.Timespan != nil { reqQP.Set("timespan", *options.Timespan) @@ -296,6 +302,9 @@ func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx contex if options != nil && options.ValidateDimensions != nil { reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) } + if options != nil && options.Rollupby != nil { + reqQP.Set("rollupby", *options.Rollupby) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -310,7 +319,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 deleted file mode 100644 index 4e49074eae0d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go +++ /dev/null @@ -1,1483 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetric.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: to.Ptr("count"), - Top: to.Ptr[int32](10), - Orderby: to.Ptr("count desc"), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00: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"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricMetadata.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z"), - Interval: nil, - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("LUN eq '0'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Interval: to.Ptr("PT1M"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-10T02:23:16Z/2021-06-12T02:23:16Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Read Bytes/sec"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("0"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("1"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/PostMultiResourceMetricBody.json -func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricDataUsingBodyParams() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{Timespan: nil, - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: nil, - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - Body: &armmonitor.SubscriptionScopeMetricsRequestBodyParameters{ - Aggregation: to.Ptr("count"), - AutoAdjustTimegrain: to.Ptr(true), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - Interval: to.Ptr("PT6H"), - MetricNames: to.Ptr("Data Disk Max Burst IOPS"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - OrderBy: to.Ptr("count desc"), - RollUpBy: to.Ptr("LUN"), - Timespan: to.Ptr(func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00Z/2021-06-12T01:00:00Z") - return t - }()), - Top: to.Ptr[int32](10), - ValidateDimensions: to.Ptr(false), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00: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"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetric.json -func ExampleMetricsClient_List_getMetricForData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-04-20T09:00:00.000Z/2021-04-20T14:00:00.000Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("BlobCount,BlobCapacity"), - Aggregation: to.Ptr("average,minimum,maximum"), - Top: to.Ptr[int32](5), - Orderby: to.Ptr("average asc"), - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](598), - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-20T09:00:00Z/2021-04-20T14:00:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00: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}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00: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}()), - // }}, - // 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: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}()), - // }}, - // 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: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}()), - // }}, - // 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: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}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Capacity"), - // Value: to.Ptr("BlobCapacity"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The amount of storage used by the storage account’s Blob service in bytes."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00: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}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00: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}()), - // }}, - // 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: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}()), - // }}, - // 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: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}()), - // }}, - // 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: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}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitBytes), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricMetadata.json -func ExampleMetricsClient_List_getMetricForMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-15T02:18:00Z/2021-04-22T02:18:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricError.json -func ExampleMetricsClient_List_getMetricWithError() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - Interval: to.Ptr("FULL"), - Metricnames: to.Ptr("MongoRequestsCount,MongoRequests"), - Aggregation: to.Ptr("average"), - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](239), - // Interval: to.Ptr("PT4H"), - // Namespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("(deprecated) Mongo Request Rate"), - // Value: to.Ptr("MongoRequestsCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // ErrorCode: to.Ptr("InvalidSamplingType"), - // ErrorMessage: to.Ptr("Sampling type is not found. Metric:CosmosDBCustomer,AzureMonitor,MongoRequests, SamplingType:NullableAverage."), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequestsCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // }, - // Unit: to.Ptr(armmonitor.UnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Mongo Requests"), - // Value: to.Ptr("MongoRequests"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Number of Mongo Requests Made"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequests"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-07T21:51:00Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // }, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models.go b/sdk/resourcemanager/monitor/armmonitor/models.go index 5857358098d6..b10a576f9525 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -62,6 +62,27 @@ type ActionDetail struct { SubState *string } +// ActionDetailAutoGenerated - The action detail +type ActionDetailAutoGenerated struct { + // The mechanism type + MechanismType *string + + // The detail of the friendly error message + Message *string + + // The name of the action + Name *string + + // The send time + SendTime *string + + // The status of the action + Status *string + + // The substatus of the action + SubState *string +} + // ActionGroup - An Azure action group. type ActionGroup struct { // REQUIRED; Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers @@ -613,7 +634,7 @@ type AzureMonitorPrivateLinkScopeProperties struct { AccessModeSettings *AccessModeSettings // READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections []*PrivateEndpointConnection + PrivateEndpointConnections []*PrivateEndpointConnectionAutoGenerated // 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 @@ -621,36 +642,42 @@ type AzureMonitorPrivateLinkScopeProperties struct { ProvisioningState *string } -// AzureMonitorWorkspace - Properties of an Azure Monitor workspace +// 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. + // 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 + // READ-ONLY; Properties related to the metrics container in the Azure Monitor Workspace Metrics *AzureMonitorWorkspaceMetrics - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + // READ-ONLY; List of private endpoint connections + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets allow or disallow public network access to Azure Monitor Workspace + PublicNetworkAccess *PublicNetworkAccess } // 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. + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this Azure Monitor Workspace. DataCollectionEndpointResourceID *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection rule for this Azure Monitor Workspace. DataCollectionRuleResourceID *string } -// AzureMonitorWorkspaceMetrics - Information about metrics for the Azure Monitor workspace +// AzureMonitorWorkspaceMetrics - Properties related to the metrics container in 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 + // READ-ONLY; The Prometheus query endpoint for the Azure Monitor Workspace PrometheusQueryEndpoint *string } @@ -681,7 +708,7 @@ type AzureMonitorWorkspaceResource struct { Type *string } -// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for update operation +// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for the Update operation type AzureMonitorWorkspaceResourceForUpdate struct { // Resource tags Tags map[string]*string @@ -698,17 +725,23 @@ type AzureMonitorWorkspaceResourceListResult struct { // AzureMonitorWorkspaceResourceProperties - Resource properties type AzureMonitorWorkspaceResourceProperties struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. + // 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 + // READ-ONLY; Properties related to the metrics container in the Azure Monitor Workspace Metrics *AzureMonitorWorkspaceMetrics - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + // READ-ONLY; List of private endpoint connections + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets allow or disallow public network access to Azure Monitor Workspace + PublicNetworkAccess *PublicNetworkAccess } // AzureResource - An azure resource object @@ -1415,7 +1448,7 @@ type DataSourcesSpecDataImports struct { // (This also follows the OData error response format.). type DefaultErrorResponse struct { // The error object. - Error *ErrorDetail + Error *ErrorDetailAutoGenerated } // DestinationsSpec - Specification of destinations that can be used in data flows. @@ -1554,6 +1587,24 @@ type Dimension struct { Values []*string } +// DimensionProperties - Type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Default dimension value to be sent down for the hidden dimension during query + DefaultDimensionValues any + + // Display name of dimension. + DisplayName *string + + // When set, the dimension is hidden from the customer, used in conjunction with the defaultDimensionValues field below + IsHidden *bool + + // Name of dimension. + Name *string + + // Legacy usage, should not set. + ToBeExportedForShoebox *bool +} + // 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 @@ -1690,7 +1741,7 @@ type ErrorAdditionalInfo struct { // (This also follows the OData error response format.) type ErrorContract struct { // The error object. - Error *ErrorResponse + Error *ErrorResponseAutoGenerated } // ErrorContractAutoGenerated - Describes the format of Error response. @@ -1735,13 +1786,11 @@ type ErrorDetailAutoGenerated struct { Target *string } -// ErrorResponse - Describes the format of Error response. +// ErrorResponse - 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 ErrorResponse struct { - // Error code - Code *string - - // Error message indicating why the operation failed. - Message *string + // The error object. + Error *ErrorDetail } // ErrorResponseAdditionalInfo - The resource management error additional info. @@ -1753,27 +1802,59 @@ type ErrorResponseAdditionalInfo struct { Type *string } -// ErrorResponseAutoGenerated - The error response. +type ErrorResponseAdditionalInfoItem struct { + // Additional information related to the error. + Info any + + // The type of the info property (e.g. string). + Type *string +} + +// ErrorResponseAutoGenerated - Describes the format of Error response. type ErrorResponseAutoGenerated struct { - // READ-ONLY; The error code. + // Additional information about the error + AdditionalInfo []*ErrorResponseAdditionalInfoItem + + // Error code Code *string - // READ-ONLY; The error message indicating why the operation failed. + // Error message indicating why the operation failed. Message *string + + // The error target. + Target *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.). +// ErrorResponseAutoGenerated2 - Describes the format of Error response. type ErrorResponseAutoGenerated2 struct { + // Error code + Code *string + + // Error message indicating why the operation failed. + Message *string +} + +// ErrorResponseAutoGenerated3 - 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 ErrorResponseAutoGenerated3 struct { // The error object. Error *ErrorDetailAutoGenerated } +// ErrorResponseAutoGenerated4 - The error response. +type ErrorResponseAutoGenerated4 struct { + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error message indicating why the operation failed. + Message *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 + Error *ErrorDetailAutoGenerated } // ErrorResponseDetails - Common error response for all Azure Resource Manager APIs to return error details for failed operations. @@ -2050,10 +2131,10 @@ type IncidentListResult struct { // IngestionSettings - Settings for data ingestion type IngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this Azure Monitor Workspace. DataCollectionEndpointResourceID *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + // READ-ONLY; The Azure resource Id of the default data collection rule for this Azure Monitor Workspace. DataCollectionRuleResourceID *string } @@ -2085,6 +2166,15 @@ type LocalizableString struct { LocalizedValue *string } +// LocalizableStringAutoGenerated - The localizable string class. +type LocalizableStringAutoGenerated struct { + // REQUIRED; The invariant value. + Value *string + + // The display name. + LocalizedValue *string +} + type LocationSpec struct { // Name of location. Location *string @@ -2252,6 +2342,18 @@ type LogSettings struct { RetentionPolicy *RetentionPolicy } +// LogSpecification - Log specification of operation. +type LogSpecification struct { + // Blob duration of specification. + BlobDuration *string + + // Display name of log specification. + DisplayName *string + + // Name of log specification. + Name *string +} + // LogicAppReceiver - A logic app receiver. type LogicAppReceiver struct { // REQUIRED; The callback url where http request sent to. @@ -2341,29 +2443,29 @@ type Metadata struct { // MetadataValue - Represents a metric metadata value. type MetadataValue struct { - // the name of the metadata. - Name *LocalizableString + // The name of the metadata. + Name *LocalizableStringAutoGenerated - // 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. - Name *LocalizableString + // REQUIRED; The name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableStringAutoGenerated - // 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 @@ -2596,10 +2698,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 the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. TimeGrain *string } @@ -2680,46 +2782,46 @@ type MetricDefinition struct { // Custom category name for this metric. Category *string - // the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions []*LocalizableString + // The name and the display name of the dimension, i.e. it is a localizable string. + Dimensions []*LocalizableStringAutoGenerated // 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. - Name *LocalizableString + // The name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableStringAutoGenerated - // 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 } @@ -2791,6 +2893,48 @@ type MetricSingleDimension struct { Value *string } +// MetricSpecification - Metric specification of operation. +type MetricSpecification struct { + // The default metric aggregation type. Possible values include: Total,Average,Maximum,Minimum,Count + AggregationType *string + + // The supported time grain types for the metrics. + Availabilities []*string + + // Category or type of metric. + Category *string + + // The dimensions of metric. + Dimensions []*DimensionProperties + + // Display description of the metric. + DisplayDescription *string + + // Display name of the metric. + DisplayName *string + + // Property to specify whether to fill empty gaps with zero. + FillGapWithZero *bool + + // The internal metric name. + InternalMetricName *string + + // The metric lock aggregation type. + LockAggregationType *string + + // The name of the metric. + Name *string + + // The supported aggregation types for the metrics. + SupportedAggregationTypes []*string + + // The supported time grain types for the metrics. + SupportedTimeGrainTypes []*string + + // The metric unit. Possible values include: Count,Bytes,Seconds,Percent,CountPerSecond,BytesPerSecond,MilliSeconds,ByteSeconds,Unspecified,BitsPerSecond,Cores,MilliCores,NanoCores + Unit *string +} + // MetricTrigger - The trigger that results in a scaling action. type MetricTrigger struct { // REQUIRED; the name of the metric that defines what the rule monitors. @@ -2834,32 +2978,32 @@ 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 +// Metrics - Properties related to the metrics container in the Azure Monitor Workspace type Metrics struct { // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system InternalID *string - // READ-ONLY; The Prometheus query endpoint for the workspace + // READ-ONLY; The Prometheus query endpoint for the Azure Monitor Workspace PrometheusQueryEndpoint *string } @@ -2960,19 +3104,10 @@ type NotificationRequestBody struct { WebhookReceivers []*WebhookReceiver } -// Operation - Microsoft Insights API operation definition. +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Display metadata associated with the operation. - Display *OperationDisplay - - // Operation name: {provider}/{resource}/{operation} - Name *string -} - -// OperationAutoGenerated - Details of a REST API operation, returned from the Resource Provider Operations API -type OperationAutoGenerated struct { // Localized display information for this particular operation. - Display *OperationDisplayAutoGenerated + Display *OperationDisplay // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType @@ -2990,20 +3125,32 @@ type OperationAutoGenerated struct { Origin *Origin } -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // Operation type: Read, write, delete, etc. - Operation *string +// OperationAutoGenerated - Details of a REST API operation, returned from the Microsoft.Insights Operations API +type OperationAutoGenerated struct { + // Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType - // Service provider: Microsoft.Insights - Provider *string + // Localized display information for this particular operation. + Display *OperationDisplayAutoGenerated - // Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string + // Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Insights/components/write", + // "Microsoft.Insights/metrics/read" + Name *string + + // Properties of operation, include log and metric specifications. + OperationProperties *OperationProperties + + // The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + // "user,system" + Origin *Origin } -// OperationDisplayAutoGenerated - Localized display information for this particular operation. -type OperationDisplayAutoGenerated struct { +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -3020,33 +3167,59 @@ type OperationDisplayAutoGenerated struct { Resource *string } -// OperationListResult - Result of the request to list Microsoft.Insights operations. It contains a list of operations and -// a URL link to get the next set of results. +// OperationDisplayAutoGenerated - Localized display information for this particular operation. +type OperationDisplayAutoGenerated struct { + // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Reading an application insights component + // configuration", "Application Insights component metrics read". + Operation *string + + // The localized friendly form of the resource provider name, e.g. "Microsoft Azure Monitor". + Provider *string + + // The publisher of this operation. + Publisher *string + + // The localized friendly name of the resource type related to this operation. E.g. "Application insights components" or "Log + // Definitions". + Resource *string +} + +// OperationListResult - 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 OperationListResult struct { - // URL to get the next set of operation list results if there are any. + // READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // List of operations supported by the Microsoft.Insights provider. + // READ-ONLY; List of operations supported by the resource provider Value []*Operation } -// OperationListResultAutoGenerated - A list of REST API operations supported by an Azure Resource Provider. It contains an -// URL link to get the next set of results. +// OperationListResultAutoGenerated - A list of REST API operations supported by the Microsoft.Insights 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). + // URL to get the next set of operation list results (if there are any). NextLink *string - // READ-ONLY; List of operations supported by the resource provider + // List of operations supported by the Microsoft.Insights provider. Value []*OperationAutoGenerated } +// OperationProperties - Properties of operation, include metric specifications. +type OperationProperties struct { + // One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification +} + // 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 + Error *ErrorDetailAutoGenerated // The operation Id. ID *string @@ -3132,17 +3305,41 @@ 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. + ID *string +} + +// PrivateEndpointAutoGenerated - The Private Endpoint resource. +type PrivateEndpointAutoGenerated struct { // READ-ONLY; The ARM identifier for Private Endpoint ID *string } -// PrivateEndpointConnection - The Private Endpoint Connection resource. +// PrivateEndpointConnection - The private endpoint connection resource. type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// PrivateEndpointConnectionAutoGenerated - The Private Endpoint Connection resource. +type PrivateEndpointConnectionAutoGenerated struct { + // Resource properties. + Properties *PrivateEndpointConnectionPropertiesAutoGenerated + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -3156,18 +3353,33 @@ type PrivateEndpointConnection struct { // PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account type PrivateEndpointConnectionListResult struct { // Array of private endpoint connections - Value []*PrivateEndpointConnection + Value []*PrivateEndpointConnectionAutoGenerated } -// 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. + // The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string +} + +// PrivateEndpointConnectionPropertiesAutoGenerated - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionPropertiesAutoGenerated struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private end point. + PrivateEndpoint *PrivateEndpointAutoGenerated + + // The provisioning state of the private endpoint connection resource. ProvisioningState *PrivateEndpointConnectionProvisioningState } @@ -3318,8 +3530,38 @@ type RecurrentSchedule struct { TimeZone *string } -// Resource - The autoscale setting resource. +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// ResourceAutoGenerated - Common fields that are returned in the response for all Azure Resource Manager resources +type ResourceAutoGenerated struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAutoGenerated2 - The autoscale setting resource. +type ResourceAutoGenerated2 struct { // REQUIRED; Resource location Location *string @@ -3341,8 +3583,8 @@ type Resource struct { Type *string } -// ResourceAutoGenerated - An azure resource object -type ResourceAutoGenerated struct { +// ResourceAutoGenerated3 - An azure resource object +type ResourceAutoGenerated3 struct { // REQUIRED; Resource location Location *string @@ -3359,8 +3601,8 @@ type ResourceAutoGenerated struct { Type *string } -// ResourceAutoGenerated2 - An azure resource object -type ResourceAutoGenerated2 struct { +// ResourceAutoGenerated4 - An azure resource object +type ResourceAutoGenerated4 struct { // REQUIRED; Resource location Location *string @@ -3377,8 +3619,8 @@ type ResourceAutoGenerated2 struct { Type *string } -// ResourceAutoGenerated3 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated3 struct { +// 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 @@ -3389,8 +3631,8 @@ type ResourceAutoGenerated3 struct { Type *string } -// ResourceAutoGenerated4 - An azure resource object -type ResourceAutoGenerated4 struct { +// ResourceAutoGenerated6 - An azure resource object +type ResourceAutoGenerated6 struct { // REQUIRED; Resource location Location *string @@ -3407,21 +3649,6 @@ type ResourceAutoGenerated4 struct { Type *string } -// ResourceAutoGenerated5 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated5 struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // ResourceForUpdate - Definition of ARM tracked top level resource properties for update operation. type ResourceForUpdate struct { // Managed Service Identity. @@ -3458,15 +3685,16 @@ type Response struct { // 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 @@ -3923,6 +4151,18 @@ type SenderAuthorization struct { Scope *string } +// ServiceSpecification - One property of operation, include log specifications. +type ServiceSpecification struct { + // Legacy Metric specifications for operation. Deprecated, do not use. + LegacyMetricSpecifications any + + // Log specifications of operation. + LogSpecifications []*LogSpecification + + // Metric specifications of operation. + MetricSpecifications []*MetricSpecification +} + // SingleBaseline - The baseline values for a single sensitivity value. type SingleBaseline struct { // REQUIRED; The high thresholds of the baseline. @@ -4010,72 +4250,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. - Dimensions []*LocalizableString + // The name and the display name of the dimension, i.e. it is a localizable string. + Dimensions []*LocalizableStringAutoGenerated // 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. - Name *LocalizableString + // The name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableStringAutoGenerated - // 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 } @@ -4085,31 +4298,6 @@ type SubscriptionScopeMetricDefinitionCollection struct { 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 -} - // SubscriptionScopeMetricsRequestBodyParameters - Query parameters can also be specified in the body, specifying the same // parameter in both the body and query parameters will result in an error. type SubscriptionScopeMetricsRequestBodyParameters struct { @@ -4135,7 +4323,9 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { // $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. @@ -4157,7 +4347,7 @@ type SubscriptionScopeMetricsRequestBodyParameters struct { RollUpBy *string // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *time.Time + Timespan *string // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. Top *int32 @@ -4268,6 +4458,27 @@ type TenantActionGroupResource struct { Type *string } +// TenantNotificationRequestBody - The request body which contain contact detail metadata +type TenantNotificationRequestBody struct { + // REQUIRED; The value of the supported alert type. Supported alert type value is: servicehealth + AlertType *string + + // The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers []*AzureAppPushReceiverAutoGenerated + + // The list of email receivers that are part of this action group. + EmailReceivers []*EmailReceiverAutoGenerated + + // The list of SMS receivers that are part of this action group. + SmsReceivers []*SmsReceiverAutoGenerated + + // The list of voice receivers that are part of this action group. + VoiceReceivers []*VoiceReceiverAutoGenerated + + // The list of webhook receivers that are part of this action group. + WebhookReceivers []*WebhookReceiverAutoGenerated +} + // TestNotificationDetailsResponse - The details of the test notification results. type TestNotificationDetailsResponse struct { // REQUIRED; The overall state @@ -4286,6 +4497,24 @@ type TestNotificationDetailsResponse struct { CreatedTime *string } +// TestNotificationDetailsResponseAutoGenerated - The details of the test notification results. +type TestNotificationDetailsResponseAutoGenerated struct { + // REQUIRED; The overall state + State *string + + // The list of action detail + ActionDetails []*ActionDetailAutoGenerated + + // The completed time + CompletedTime *string + + // The context info + Context *Context + + // The created time + 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 @@ -4342,7 +4571,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 } @@ -4400,6 +4629,9 @@ type TrackedResource 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 } @@ -4419,9 +4651,6 @@ type TrackedResourceAutoGenerated 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 } diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index f46d62436afe..9c4f7e52bae3 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -133,6 +133,53 @@ func (a *ActionDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActionDetailAutoGenerated. +func (a ActionDetailAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mechanismType", a.MechanismType) + populate(objectMap, "message", a.Message) + populate(objectMap, "name", a.Name) + populate(objectMap, "sendTime", a.SendTime) + populate(objectMap, "status", a.Status) + populate(objectMap, "subState", a.SubState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionDetailAutoGenerated. +func (a *ActionDetailAutoGenerated) UnmarshalJSON(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 "mechanismType": + err = unpopulate(val, "MechanismType", &a.MechanismType) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "sendTime": + err = unpopulate(val, "SendTime", &a.SendTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "subState": + err = unpopulate(val, "SubState", &a.SubState) + 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 ActionGroup. func (a ActionGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1584,7 +1631,9 @@ func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { populate(objectMap, "accountId", a.AccountID) populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -1606,9 +1655,15 @@ func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { case "metrics": err = unpopulate(val, "Metrics", &a.Metrics) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1798,7 +1853,9 @@ func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "accountId", a.AccountID) populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -1820,9 +1877,15 @@ func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) err case "metrics": err = unpopulate(val, "Metrics", &a.Metrics) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -3888,6 +3951,49 @@ func (d *Dimension) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DimensionProperties. +func (d DimensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "defaultDimensionValues", d.DefaultDimensionValues) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "isHidden", d.IsHidden) + populate(objectMap, "name", d.Name) + populate(objectMap, "toBeExportedForShoebox", d.ToBeExportedForShoebox) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. +func (d *DimensionProperties) UnmarshalJSON(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 "defaultDimensionValues": + err = unpopulate(val, "DefaultDimensionValues", &d.DefaultDimensionValues) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "isHidden": + err = unpopulate(val, "IsHidden", &d.IsHidden) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "toBeExportedForShoebox": + err = unpopulate(val, "ToBeExportedForShoebox", &d.ToBeExportedForShoebox) + 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) @@ -4346,8 +4452,7 @@ func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } @@ -4360,11 +4465,8 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { 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) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -4405,11 +4507,44 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfoItem. +func (e ErrorResponseAdditionalInfoItem) 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 ErrorResponseAdditionalInfoItem. +func (e *ErrorResponseAdditionalInfoItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } @@ -4422,12 +4557,18 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -4439,12 +4580,43 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "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 ErrorResponseAutoGenerated3. +func (e ErrorResponseAutoGenerated3) 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 ErrorResponseAutoGenerated3. +func (e *ErrorResponseAutoGenerated3) UnmarshalJSON(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) @@ -4463,6 +4635,37 @@ func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated4. +func (e ErrorResponseAutoGenerated4) 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 ErrorResponseAutoGenerated4. +func (e *ErrorResponseAutoGenerated4) UnmarshalJSON(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 ErrorResponseCommonV2. func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5216,6 +5419,37 @@ func (l *LocalizableString) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LocalizableStringAutoGenerated. +func (l LocalizableStringAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", l.LocalizedValue) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableStringAutoGenerated. +func (l *LocalizableStringAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LocationSpec. func (l LocationSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5659,6 +5893,41 @@ func (l *LogSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LogSpecification. +func (l LogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobDuration", l.BlobDuration) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSpecification. +func (l *LogSpecification) UnmarshalJSON(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 "blobDuration": + err = unpopulate(val, "BlobDuration", &l.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6947,26 +7216,27 @@ func (m *MetricSingleDimension) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. -func (m MetricTrigger) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "availabilities", m.Availabilities) + populate(objectMap, "category", m.Category) populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "dividePerInstance", m.DividePerInstance) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) - populate(objectMap, "metricResourceUri", m.MetricResourceURI) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "statistic", m.Statistic) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - populate(objectMap, "timeGrain", m.TimeGrain) - populate(objectMap, "timeWindow", m.TimeWindow) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "internalMetricName", m.InternalMetricName) + populate(objectMap, "lockAggregationType", m.LockAggregationType) + populate(objectMap, "name", m.Name) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricTrigger. -func (m *MetricTrigger) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSpecification. +func (m *MetricSpecification) UnmarshalJSON(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) @@ -6974,10 +7244,84 @@ func (m *MetricTrigger) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &m.AggregationType) + delete(rawMsg, key) + case "availabilities": + err = unpopulate(val, "Availabilities", &m.Availabilities) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) case "dimensions": err = unpopulate(val, "Dimensions", &m.Dimensions) delete(rawMsg, key) - case "dividePerInstance": + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "fillGapWithZero": + err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero) + delete(rawMsg, key) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &m.InternalMetricName) + delete(rawMsg, key) + case "lockAggregationType": + err = unpopulate(val, "LockAggregationType", &m.LockAggregationType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) + delete(rawMsg, key) + case "supportedTimeGrainTypes": + err = unpopulate(val, "SupportedTimeGrainTypes", &m.SupportedTimeGrainTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. +func (m MetricTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "dividePerInstance", m.DividePerInstance) + populate(objectMap, "metricName", m.MetricName) + populate(objectMap, "metricNamespace", m.MetricNamespace) + populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) + populate(objectMap, "metricResourceUri", m.MetricResourceURI) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "statistic", m.Statistic) + populate(objectMap, "threshold", m.Threshold) + populate(objectMap, "timeAggregation", m.TimeAggregation) + populate(objectMap, "timeGrain", m.TimeGrain) + populate(objectMap, "timeWindow", m.TimeWindow) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricTrigger. +func (m *MetricTrigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "dividePerInstance": err = unpopulate(val, "DividePerInstance", &m.DividePerInstance) delete(rawMsg, key) case "metricName": @@ -7325,8 +7669,11 @@ func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) 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) } @@ -7339,12 +7686,21 @@ func (o *Operation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -7360,6 +7716,7 @@ func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.OperationProperties) populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) } @@ -7385,6 +7742,9 @@ func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "OperationProperties", &o.OperationProperties) + delete(rawMsg, key) case "origin": err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) @@ -7399,6 +7759,7 @@ func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) 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) @@ -7414,6 +7775,9 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) case "operation": err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) @@ -7437,6 +7801,7 @@ func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) + populate(objectMap, "publisher", o.Publisher) populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } @@ -7459,6 +7824,9 @@ func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { case "provider": err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &o.Publisher) + delete(rawMsg, key) case "resource": err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) @@ -7532,6 +7900,33 @@ func (o *OperationListResultAutoGenerated) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) UnmarshalJSON(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 "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationStatus. func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7781,18 +8176,88 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointAutoGenerated. +func (p PrivateEndpointAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointAutoGenerated. +func (p *PrivateEndpointAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionAutoGenerated. +func (p PrivateEndpointConnectionAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionAutoGenerated. +func (p *PrivateEndpointConnectionAutoGenerated) UnmarshalJSON(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) @@ -7850,6 +8315,7 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", p.ProvisioningState) @@ -7858,6 +8324,44 @@ func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionPropertiesAutoGenerated. +func (p PrivateEndpointConnectionPropertiesAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesAutoGenerated. +func (p *PrivateEndpointConnectionPropertiesAutoGenerated) UnmarshalJSON(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) @@ -8228,10 +8732,8 @@ func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -8248,18 +8750,12 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -8275,9 +8771,8 @@ func (r *Resource) UnmarshalJSON(data []byte) error { func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -8294,14 +8789,11 @@ func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) @@ -8320,6 +8812,7 @@ func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) @@ -8343,6 +8836,9 @@ func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) @@ -8361,7 +8857,9 @@ func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -8378,9 +8876,15 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -8440,7 +8944,6 @@ func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -8460,8 +8963,48 @@ func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated6. +func (r ResourceAutoGenerated6) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated6. +func (r *ResourceAutoGenerated6) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) @@ -9543,6 +10086,41 @@ func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "legacyMetricSpecifications", s.LegacyMetricSpecifications) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSpecification. +func (s *ServiceSpecification) UnmarshalJSON(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 "legacyMetricSpecifications": + err = unpopulate(val, "LegacyMetricSpecifications", &s.LegacyMetricSpecifications) + delete(rawMsg, key) + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &s.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &s.MetricSpecifications) + 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) @@ -9792,61 +10370,6 @@ 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) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinition. func (s SubscriptionScopeMetricDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9949,53 +10472,6 @@ func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricResponse. -func (s SubscriptionScopeMetricResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", s.Cost) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "resourceregion", s.Resourceregion) - populate(objectMap, "timespan", s.Timespan) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricResponse. -func (s *SubscriptionScopeMetricResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &s.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &s.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10309,6 +10785,53 @@ func (t *TenantActionGroupResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TenantNotificationRequestBody. +func (t TenantNotificationRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertType", t.AlertType) + populate(objectMap, "azureAppPushReceivers", t.AzureAppPushReceivers) + populate(objectMap, "emailReceivers", t.EmailReceivers) + 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 TenantNotificationRequestBody. +func (t *TenantNotificationRequestBody) UnmarshalJSON(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 "alertType": + err = unpopulate(val, "AlertType", &t.AlertType) + delete(rawMsg, key) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &t.AzureAppPushReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &t.EmailReceivers) + 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 TestNotificationDetailsResponse. func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10352,6 +10875,49 @@ func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponseAutoGenerated. +func (t TestNotificationDetailsResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionDetails", t.ActionDetails) + populate(objectMap, "completedTime", t.CompletedTime) + populate(objectMap, "context", t.Context) + populate(objectMap, "createdTime", t.CreatedTime) + populate(objectMap, "state", t.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponseAutoGenerated. +func (t *TestNotificationDetailsResponseAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionDetails": + err = unpopulate(val, "ActionDetails", &t.ActionDetails) + delete(rawMsg, key) + case "completedTime": + err = unpopulate(val, "CompletedTime", &t.CompletedTime) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &t.Context) + delete(rawMsg, key) + case "createdTime": + err = unpopulate(val, "CreatedTime", &t.CreatedTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10522,6 +11088,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -10545,6 +11112,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -10565,7 +11135,6 @@ func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -10589,9 +11158,6 @@ func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go index 83c69b67c83b..98b2e4dd8422 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // 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 +// Generated from API version 2023-10-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 @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2023-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -81,7 +81,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go deleted file mode 100644 index 355e0f5525d9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,433 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationListResult = armmonitor.OperationListResult{ - // Value: []*armmonitor.Operation{ - // { - // Name: to.Ptr("Microsoft.Insights/Operations/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Operations read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Operations"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Metrics/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metrics read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metrics"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Incidents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule Incidents read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rule Incident resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/providers/Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity Log Alert Activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity Log Alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/EventCategories/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event category read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Event category"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/values/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management values read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/digestevents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management digest read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Digest events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log Definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaleup/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale up operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaledown/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale down operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Resolved/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule resolved"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Throttled/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule throttled"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Register/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Register Microsoft.Insights"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Microsoft.Insights"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks write"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks delete"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go index 57ad2f4905ea..360c45bcb217 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go @@ -39,7 +39,7 @@ func NewOperationsForMonitorClient(credential azcore.TokenCredential, options *a // NewListPager - Lists available Operations for this Resource Provider // -// Generated from API version 2021-06-03-preview +// Generated from API version 2023-04-03 // - options - OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager // method. func (client *OperationsForMonitorClient) NewListPager(options *OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse] { @@ -80,7 +80,7 @@ func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") + reqQP.Set("api-version", "2023-04-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -89,7 +89,7 @@ func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsForMonitorClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go deleted file mode 100644 index 19685e884442..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json -func ExampleOperationsForMonitorClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsForMonitorClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResultAutoGenerated = armmonitor.OperationListResultAutoGenerated{ - // Value: []*armmonitor.OperationAutoGenerated{ - // { - // Name: to.Ptr("microsoft.monitor/accounts/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/write"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Create or Update any Azure Monitor Workspace"), - // Operation: to.Ptr("Create or Update Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/delete"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Delete any Azure Monitor Workspace"), - // Operation: to.Ptr("Delete Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read Azure Monitor Workspace metrics"), - // Operation: to.Ptr("Read Azure Monitor Workspace metrics"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/data/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read metrics data in any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Metrics Data"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/options.go b/sdk/resourcemanager/monitor/armmonitor/options.go index b737f70d4922..dd102a787d22 100644 --- a/sdk/resourcemanager/monitor/armmonitor/options.go +++ b/sdk/resourcemanager/monitor/armmonitor/options.go @@ -177,15 +177,16 @@ type AutoscaleSettingsClientUpdateOptions struct { // placeholder for future optional parameters } -// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create +// AzureMonitorWorkspacesClientBeginDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.BeginDelete // method. -type AzureMonitorWorkspacesClientCreateOptions struct { - // placeholder for future optional parameters +type AzureMonitorWorkspacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete +// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create // method. -type AzureMonitorWorkspacesClientDeleteOptions struct { +type AzureMonitorWorkspacesClientCreateOptions struct { // placeholder for future optional parameters } @@ -250,6 +251,19 @@ type BaselinesClientListOptions struct { Timespan *string } +// ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel +// method. +type ClientBeginCreateNotificationsAtTenantActionGroupResourceLevelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions contains the optional parameters for the Client.GetTestNotificationsAtTenantActionGroupResourceLevel +// method. +type ClientGetTestNotificationsAtTenantActionGroupResourceLevelOptions struct { + // placeholder for future optional parameters +} + // DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create // method. type DataCollectionEndpointsClientCreateOptions struct { @@ -464,14 +478,14 @@ type MetricAlertsStatusClientListOptions struct { // placeholder for future optional parameters } -// MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager +// MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.ListAtSubscriptionScope // method. type MetricDefinitionsClientListAtSubscriptionScopeOptions struct { // Metric namespace where the metrics you want reside. Metricnamespace *string } -// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager method. +// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.List method. type MetricDefinitionsClientListOptions struct { // Metric namespace where the metrics you want reside. Metricnamespace *string @@ -486,7 +500,7 @@ type MetricNamespacesClientListOptions struct { // MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope // method. type MetricsClientListAtSubscriptionScopeOptions struct { - // The list of aggregation types (comma separated) to retrieve. + // 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 @@ -508,7 +522,9 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // $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. @@ -517,17 +533,23 @@ type MetricsClientListAtSubscriptionScopeOptions 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. + Rollupby *string + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // 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 @@ -538,7 +560,7 @@ type MetricsClientListAtSubscriptionScopeOptions struct { // MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost // method. type MetricsClientListAtSubscriptionScopePostOptions struct { - // The list of aggregation types (comma separated) to retrieve. + // 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 @@ -563,7 +585,9 @@ type MetricsClientListAtSubscriptionScopePostOptions struct { // $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. @@ -572,17 +596,23 @@ type MetricsClientListAtSubscriptionScopePostOptions 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. + Rollupby *string + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *string - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + // 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 @@ -592,7 +622,7 @@ 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. + // 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 @@ -614,7 +644,9 @@ type MetricsClientListOptions struct { // $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. @@ -623,17 +655,23 @@ type MetricsClientListOptions 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 *ResultType + // Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle + // or City eq Tacoma' but don't want to see separate values for each city, + // you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. + Rollupby *string + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. Timespan *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 diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go deleted file mode 100644 index f4c472581a1b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json -func ExamplePredictiveMetricClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPredictiveMetricClient().Get(ctx, "myRG", "vmss1-Autoscale-775", "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", "PT1H", "Microsoft.Compute/virtualMachineScaleSets", "PercentageCPU", "Total", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PredictiveResponse = armmonitor.PredictiveResponse{ - // Data: []*armmonitor.PredictiveValue{ - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:00: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), - // }}, - // 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 fb052b373bb2..0549f158dbc2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go @@ -52,7 +52,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // - privateEndpointConnectionName - The name of the private endpoint connection. // - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) if err != nil { @@ -69,7 +69,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // 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) { +func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -91,7 +91,7 @@ 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) { +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionAutoGenerated, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -264,7 +264,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { result := PrivateEndpointConnectionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionAutoGenerated); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go deleted file mode 100644 index beac5fb035f5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", armmonitor.PrivateEndpointConnection{ - Properties: &armmonitor.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionListResult = armmonitor.PrivateEndpointConnectionListResult{ - // Value: []*armmonitor.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go deleted file mode 100644 index 3d2730ab12e0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armmonitor.PrivateLinkResourceListResult{ - // Value: []*armmonitor.PrivateLinkResource{ - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmonitor.PrivateLinkResource{ - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go deleted file mode 100644 index 3ef58d8ce8e6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json -func ExamplePrivateLinkScopedResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopedResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", armmonitor.ScopedResource{ - Properties: &armmonitor.ScopedResourceProperties{ - LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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 -func ExamplePrivateLinkScopedResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json -func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopedResourcesClient().NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScopedResourceListResult = armmonitor.ScopedResourceListResult{ - // Value: []*armmonitor.ScopedResource{ - // { - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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"), - // }, - // 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_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go deleted file mode 100644 index d8612988e855..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json -func ExamplePrivateLinkScopeOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopeOperationStatusClient().Get(ctx, "713192d7-503f-477a-9cfe-4efc3ee2bd11", "MyResourceGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armmonitor.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T16:13:13.933Z"); return t}()), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopeOperationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T13:13:13.933Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go deleted file mode 100644 index 6b5f6754d64e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,405 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json -func ExamplePrivateLinkScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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("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.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/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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("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.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/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopesClient().BeginDelete(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json -func ExamplePrivateLinkScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().Get(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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/PrivateLinkScopesUpdate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().UpdateTags(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // "Tag2": to.Ptr("Value2"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.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/response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go index 812a8e44cf92..80a4d26ecdbe 100644 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/response_types.go @@ -189,7 +189,7 @@ type AzureMonitorWorkspacesClientCreateResponse struct { AzureMonitorWorkspaceResource } -// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.Delete. +// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.BeginDelete. type AzureMonitorWorkspacesClientDeleteResponse struct { // placeholder for future response values } @@ -224,6 +224,18 @@ type BaselinesClientListResponse struct { MetricBaselinesResponse } +// ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse contains the response from method Client.BeginCreateNotificationsAtTenantActionGroupResourceLevel. +type ClientCreateNotificationsAtTenantActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponseAutoGenerated +} + +// ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse contains the response from method Client.GetTestNotificationsAtTenantActionGroupResourceLevel. +type ClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponseAutoGenerated +} + // DataCollectionEndpointsClientCreateResponse contains the response from method DataCollectionEndpointsClient.Create. type DataCollectionEndpointsClientCreateResponse struct { // Definition of ARM tracked top level resource. @@ -447,13 +459,13 @@ type MetricAlertsStatusClientListResponse struct { MetricAlertStatusCollection } -// MetricDefinitionsClientListAtSubscriptionScopeResponse contains the response from method MetricDefinitionsClient.NewListAtSubscriptionScopePager. +// MetricDefinitionsClientListAtSubscriptionScopeResponse contains the response from method MetricDefinitionsClient.ListAtSubscriptionScope. type MetricDefinitionsClientListAtSubscriptionScopeResponse struct { // Represents collection of metric definitions. SubscriptionScopeMetricDefinitionCollection } -// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.NewListPager. +// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.List. type MetricDefinitionsClientListResponse struct { // Represents collection of metric definitions. MetricDefinitionCollection @@ -467,14 +479,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. @@ -485,15 +497,15 @@ type MetricsClientListResponse struct { // 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 + // A list of REST API operations supported by the Microsoft.Insights Azure Resource Provider. It contains an URL link to get + // the next set of results. + OperationListResultAutoGenerated } // 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 + OperationListResult } // PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. @@ -505,7 +517,7 @@ type PredictiveMetricClientGetResponse struct { // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { // The Private Endpoint Connection resource. - PrivateEndpointConnection + PrivateEndpointConnectionAutoGenerated } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. @@ -516,7 +528,7 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { // The Private Endpoint Connection resource. - PrivateEndpointConnection + PrivateEndpointConnectionAutoGenerated } // PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.ListByPrivateLinkScope. diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go deleted file mode 100644 index 405112627130..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go +++ /dev/null @@ -1,859 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json -func ExampleScheduledQueryRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/MyResourceGroupName2/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json -func ExampleScheduledQueryRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListByResourceGroupPager("QueryResourceGroupName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Get(ctx, "QueryResourceGroupName", "perf", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Health check rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Heartbeat"), - Threshold: to.Ptr[float64](360), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Update(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResourcePatch{ - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Enabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(false), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go index 69b4a974b58a..a9066410c0d4 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go @@ -43,7 +43,7 @@ func NewTenantActionGroupsClient(credential azcore.TokenCredential, options *arm // 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 +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -88,7 +88,7 @@ func (client *TenantActionGroupsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-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"} @@ -110,7 +110,7 @@ func (client *TenantActionGroupsClient) createOrUpdateHandleResponse(resp *http. // Delete - Delete a tenant action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -153,7 +153,7 @@ func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-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"} @@ -163,7 +163,7 @@ func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, // Get - Get a tenant action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -206,7 +206,7 @@ func (client *TenantActionGroupsClient) getCreateRequest(ctx context.Context, ma return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-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"} @@ -224,7 +224,7 @@ func (client *TenantActionGroupsClient) getHandleResponse(resp *http.Response) ( // NewListByManagementGroupIDPager - Get a list of all tenant action groups in a management group. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2023-05-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 @@ -265,7 +265,7 @@ func (client *TenantActionGroupsClient) listByManagementGroupIDCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-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"} @@ -284,7 +284,7 @@ func (client *TenantActionGroupsClient) listByManagementGroupIDHandleResponse(re // 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 +// Generated from API version 2023-05-01-preview // - managementGroupID - The management group id. // - tenantActionGroupName - The name of the action group. // - xmsClientTenantID - The tenant ID of the client making the request. @@ -329,7 +329,7 @@ func (client *TenantActionGroupsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2023-05-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"} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go deleted file mode 100644 index e63ca7241bbc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/createOrUpdateTenantActionGroup.json -func ExampleTenantActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.TenantActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.TenantActionGroup{ - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiverAutoGenerated{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - GroupShortName: to.Ptr("sample"), - SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/getTenantActionGroup.json -func ExampleTenantActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Get(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/deleteTenantActionGroup.json -func ExampleTenantActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantActionGroupsClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/patchTenantActionGroup.json -func ExampleTenantActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.ActionGroupPatchBodyAutoGenerated{ - Properties: &armmonitor.ActionGroupPatchAutoGenerated{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/listTenantActionGroups.json -func ExampleTenantActionGroupsClient_NewListByManagementGroupIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActionGroupsClient().NewListByManagementGroupIDPager("72f988bf-86f1-41af-91ab-2d7cd011db47", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TenantActionGroupList = armmonitor.TenantActionGroupList{ - // Value: []*armmonitor.TenantActionGroupResource{ - // { - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go deleted file mode 100644 index 5cdbe10e9586..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithoutFilterOrSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.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"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go deleted file mode 100644 index 6834327911e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,219 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmScaleSetThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatHasNotYetReportedData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // }, - // DataStatus: to.Ptr(armmonitor.DataStatusNotPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusUnknown), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAResourceGroupThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForASubscriptionThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring-secondary"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("f096d163-206e-4abf-9db3-2c62af003d68"), - // }, - // }, - // }, - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87"), - // }, - // } -}